PluginProbe ʕ •ᴥ•ʔ
Zenchef widget integration / 1.3.0
Zenchef widget integration v1.3.0
1.3.0 1.0.1 1.2.0 trunk 1.0.0
zenchef-widget-integration / src / Widget / load_script_template_file.php
zenchef-widget-integration / src / Widget Last commit date
Backoffice 2 months ago build_widget_data_attributes.php 2 months ago enqueue_widget_sdk.php 2 weeks ago get_widget_settings.php 2 months ago load_script_file.php 2 weeks ago load_script_template_file.php 2 weeks ago load_translations.php 2 years ago register_consent_api.php 2 weeks ago register_shortcode.php 2 weeks ago sanitize_restaurant_id.php 2 months ago sanitize_widget_settings.php 2 months ago
load_script_template_file.php
32 lines
1 <?php
2
3 namespace Zenchef\Widget\Widget;
4
5 use function Zenchef\Widget\View\render;
6
7 /**
8 * @return string
9 */
10 function load_script_template_file()
11 {
12 if (widget_shortcode_was_rendered()) {
13 return '';
14 }
15
16 // Without this the configuration element would still be emitted when the SDK
17 // has been suppressed, leaving dead markup on the page.
18 if (!widget_should_load()) {
19 return '';
20 }
21
22 $settings = get_widget_settings();
23
24 return render(
25 'main',
26 [
27 'restaurant_id' => $settings['restaurant_id'],
28 'data_attributes' => build_widget_data_attributes($settings),
29 ]
30 );
31 }
32