-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebinar.js
More file actions
58 lines (52 loc) · 1.99 KB
/
Copy pathwebinar.js
File metadata and controls
58 lines (52 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
(function() {
const __ = wp.i18n.__;
const { addFilter } = wp.hooks;
const { InspectorControls } = wp.blockEditor;
const { PanelBody, TextControl } = wp.components;
const { Fragment, createElement } = wp.element;
addFilter(
'blocks.registerBlockType',
'piotrpress-hubspot-form/goToWebinarWebinarKey-attribute',
function(settings, name) {
if (name !== 'piotrpress/hubspot-form') return settings;
settings.attributes = {
...settings.attributes,
goToWebinarWebinarKey: {
type: 'string'
},
};
return settings;
}
);
addFilter(
'editor.BlockEdit',
'piotrpress-hubspot-form/goToWebinarWebinarKey-control',
function(BlockEdit) {
return function(props) {
if (props.name !== 'piotrpress/hubspot-form') return createElement(BlockEdit, props);
const { attributes, setAttributes } = props;
const { goToWebinarWebinarKey } = attributes;
return createElement(
Fragment,
{},
createElement(BlockEdit, props),
createElement(
InspectorControls,
{},
createElement(
PanelBody,
{ title: __('GoToWebinar', 'piotrpress-hubspot-form') },
createElement(TextControl, {
label: __('Webinar Key', 'piotrpress-hubspot-form'),
value: goToWebinarWebinarKey,
onChange: function(webinarKey) {
setAttributes({ goToWebinarWebinarKey: webinarKey });
}
})
)
)
);
};
}
);
})();