Skip to content

Commit 3c0c069

Browse files
committed
fix: separate loading of presets in another function
1 parent 0746077 commit 3c0c069

File tree

1 file changed

+7
-3
lines changed
  • src/plugins/global-settings/preset-controls

1 file changed

+7
-3
lines changed

src/plugins/global-settings/preset-controls/index.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,15 @@ class Stackable_Size_And_Spacing_Preset_Controls {
4242
* Initialize
4343
*/
4444
function __construct() {
45+
add_filter( 'stackable_inline_styles_nodep', array( $this, 'add_preset_controls_styles' ) );
46+
add_filter( 'stackable_inline_editor_styles', array( $this, 'add_preset_controls_styles' ) );
47+
}
48+
49+
public function load_presets() {
4550
$this->custom_presets = get_option( 'stackable_global_custom_preset_controls' );
4651
$this->theme_presets = WP_Theme_JSON_Resolver::get_theme_data()->get_settings();
4752
$this->default_presets = WP_Theme_JSON_Resolver::get_core_data()->get_settings();
4853
$this->stackable_presets = $this->load_json_file( __DIR__ . '/presets.json');
49-
50-
add_filter( 'stackable_inline_styles_nodep', array( $this, 'add_preset_controls_styles' ) );
51-
add_filter( 'stackable_inline_editor_styles', array( $this, 'add_preset_controls_styles' ) );
5254
}
5355

5456
public static function sanitize_array_setting( $input ) {
@@ -130,6 +132,8 @@ public function deepGet( $array, $keys ) {
130132
* @return String
131133
*/
132134
public function add_preset_controls_styles( $current_css ) {
135+
$this->load_presets();
136+
133137
$generated_css = "\n/* Global Preset Controls */\n";
134138
$generated_css .= ":root {\n";
135139

0 commit comments

Comments
 (0)