PluginProbe
GutSlider – All in One Slider and Carousel Blocks for Gutenberg / 3.2.0
GutSlider – All in One Slider and Carousel Blocks for Gutenberg v3.2.0
3.2.0 3.1.0 3.0.0 2.13.2 2.13.1 2.13.0 trunk 1.0.0 2.1.0 2.10.0 2.10.1 2.11.0 2.11.1 2.11.2 2.11.3 2.11.4 2.12.0 2.2.1 2.2.2 2.3.0 2.4.0 2.5.1 2.5.3 2.5.4 2.5.5 All 57 releases
← All changes | includes/Assets/EnqueueAssets.php +30 -0 2.13.0 → 3.2.0 View file →
@@ -59,8 +59,38 @@
59 59 public function enqueue_editor_assets(): void {
60 60 $this->enqueue_asset( 'global', true, true );
61 61 $this->enqueue_asset( 'modules', false );
62 62 $this->localize_preview_images();
63 + $this->localize_editor_settings();
64 + }
65 +
66 + /**
67 + * Expose editor-facing settings to the global editor bundle.
68 + *
69 + * Printed as an inline script rather than via wp_localize_script so the
70 + * values keep their real types — wp_localize_script casts top level
71 + * scalars to strings, which would turn `false` into a truthy "".
72 + *
73 + * @since 3.0.0
74 + *
75 + * @return void
76 + */
77 + private function localize_editor_settings(): void {
78 + $settings = get_option( 'gutslider_settings', array() );
79 +
80 + $pattern_library = ! is_array( $settings ) || ! array_key_exists( 'pattern_library', $settings )
81 + ? true
82 + : (bool) $settings['pattern_library'];
83 +
84 + wp_add_inline_script(
85 + 'gutslider-blocks-global-script',
86 + 'window.gutsliderEditor = ' . wp_json_encode(
87 + array(
88 + 'patternLibrary' => $pattern_library,
89 + )
90 + ) . ';',
91 + 'before'
92 + );
63 93 }
64 94
65 95 /**
66 96 * Enqueue front-end and shared assets.