Backoffice
1 month ago
build_widget_data_attributes.php
1 month ago
get_widget_settings.php
1 month ago
load_script_file.php
1 month ago
load_script_template_file.php
1 month ago
load_translations.php
1 year ago
register_shortcode.php
1 month ago
sanitize_restaurant_id.php
1 month ago
sanitize_widget_settings.php
1 month ago
load_script_file.php
34 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Zenchef\Widget\Widget; |
| 4 | |
| 5 | use function get_option; |
| 6 | use function plugins_url; |
| 7 | use function wp_enqueue_script; |
| 8 | use const Zenchef\Widget\PLUGIN_VERSION; |
| 9 | use const Zenchef\Widget\SETTINGS_OPTION_NAME; |
| 10 | |
| 11 | /** |
| 12 | * @return void |
| 13 | */ |
| 14 | function load_script_file() |
| 15 | { |
| 16 | $parameters = get_option(SETTINGS_OPTION_NAME, [ |
| 17 | 'restaurant_id' => '', |
| 18 | 'open_delay' => 3000, |
| 19 | 'position' => 'right', |
| 20 | ]); |
| 21 | |
| 22 | if ($parameters['restaurant_id'] === '') { |
| 23 | return; |
| 24 | } |
| 25 | |
| 26 | wp_enqueue_script( |
| 27 | 'zenchef-widget-integration', |
| 28 | plugins_url('../../js/main.js', __FILE__), |
| 29 | [], |
| 30 | PLUGIN_VERSION, |
| 31 | true |
| 32 | ); |
| 33 | } |
| 34 |