PluginProbe
HubSpot All-In-One Marketing – Forms, Popups, Live Chat / 11.3.75
HubSpot All-In-One Marketing – Forms, Popups, Live Chat v11.3.75
11.3.75 11.3.73 11.3.71 11.3.70 11.3.69 11.3.64 11.3.65 11.3.62 11.3.61 11.3.56 11.3.58 11.0.31 11.0.52 11.0.54 11.0.56 11.0.58 11.0.7 11.1.10 11.1.11 11.1.13 11.1.14 11.1.15 11.1.2 11.1.20 11.1.21 All 73 releases
← All changes | public/utils/class-shortcoderenderutils.php +42 -17 11.1.2111.3.75 View file →
@@ -40,10 +40,11 @@
40 40 */
41 41 private static function render_form( $attrs ) {
42 42 $parsed_attributes = shortcode_atts(
43 43 array(
44 - 'portal' => null,
45 - 'id' => null,
44 + 'portal' => null,
45 + 'id' => null,
46 + 'version' => null,
46 47 ),
47 48 $attrs
48 49 );
49 50
@@ -48,9 +49,9 @@
48 49 );
49 50
50 51 $portal_id = $parsed_attributes['portal'];
51 52 $id = $parsed_attributes['id'];
52 -
53 + $version = $parsed_attributes['version'];
53 54 if ( ! isset( $portal_id ) || ! isset( $id ) || ! is_numeric( $portal_id ) ||
54 55 ! ( self::is_valid_uuid( $id ) || is_numeric( $id ) ) ) {
55 56 return;
56 57 }
@@ -56,22 +57,36 @@
56 57 }
57 58
58 59 $form_div_uuid = self::generate_div_uuid();
59 60 $hublet = Filters::apply_hublet_filters();
60 - AssetsManager::enqueue_forms_script();
61 - return '
62 - <script>
63 - window.hsFormsOnReady = window.hsFormsOnReady || [];
64 - window.hsFormsOnReady.push(()=>{
65 - hbspt.forms.create({
66 - portalId: ' . $portal_id . ',
67 - formId: "' . $id . '",
68 - target: "#hbspt-form-' . $form_div_uuid . '",
69 - region: "' . $hublet . '",
70 - ' . Filters::apply_forms_payload_filters() . '
71 - })});
72 - </script>
73 - <div class="hbspt-form" id="hbspt-form-' . $form_div_uuid . '"></div>';
61 +
62 + if ( isset( $version ) && 'v4' === $version ) {
63 + AssetsManager::enqueue_form_v4_script( $portal_id );
64 + return '
65 + <div
66 + class="hs-form-frame"
67 + data-region="' . $hublet . '"
68 + data-form-id="' . $id . '"
69 + data-portal-id="' . $portal_id . '"
70 + ' . Filters::apply_forms_v4_payload_filters() . ' >
71 + </div>
72 + ';
73 + } else {
74 + AssetsManager::enqueue_forms_script();
75 + return '
76 + <script>
77 + window.hsFormsOnReady = window.hsFormsOnReady || [];
78 + window.hsFormsOnReady.push(()=>{
79 + hbspt.forms.create({
80 + portalId: ' . $portal_id . ',
81 + formId: "' . $id . '",
82 + target: "#hbspt-form-' . $form_div_uuid . '",
83 + region: "' . $hublet . '",
84 + ' . Filters::apply_forms_payload_filters() . '
85 + })});
86 + </script>
87 + <div class="hbspt-form" id="hbspt-form-' . $form_div_uuid . '"></div>';
88 + }
74 89 }
75 90
76 91 /**
77 92 * Render cta leadin shortcodes
@@ -143,8 +158,18 @@
143 158 window.hbspt.meetings.create(".meetings-iframe-container");
144 159 }
145 160 </script>
146 161 ';
162 + }
163 +
164 + /**
165 + * Wraps an embed in a pointer-events:none container for the Elementor editor,
166 + * so the iframe cannot swallow the click Elementor needs to select the widget.
167 + *
168 + * @param string $embed The embed HTML to wrap.
169 + */
170 + public static function wrap_embed_for_elementor_editor( $embed ) {
171 + return '<div class="hubspot-embed-editor-preview" style="pointer-events:none;">' . $embed . '</div>';
147 172 }
148 173
149 174 /**
150 175 * Generates 10 characters long string with random values