Skip to content

Commit ce727ce

Browse files
feat (blocksy): overridden default breakpoints will now reflect in the settings placeholders
1 parent 7246c08 commit ce727ce

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

src/dynamic-breakpoints.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ function __construct() {
4848
// 11 Priority, do this last because changing style can affect inline css optimization.
4949
add_filter( 'render_block', array( $this, 'adjust_block_styles' ), 11, 2 );
5050
}
51+
52+
// Add the default breakpoints to the localized settings.
53+
add_filter( 'stackable_localize_settings_script', array( $this, 'add_default_breakpoints' ) );
5154
}
5255

5356
/**
@@ -78,6 +81,21 @@ public function get_dynamic_breakpoints() {
7881
return $this->dynamic_breakpoints;
7982
}
8083

84+
/**
85+
* Add the default breakpoints to the localized settings to be used for
86+
* the default placeholder in the settings.
87+
*
88+
* @param Array $args
89+
* @return Array
90+
*/
91+
public function add_default_breakpoints( $args ) {
92+
$args['defaultBreakpoints'] = apply_filters( 'stackable_responsive_breakpoints', array(
93+
'tablet' => '1024',
94+
'mobile' => '768',
95+
) );
96+
return $args;
97+
}
98+
8199
/**
82100
* Register the setting where the user's dynamic breakpoints will be
83101
* saved.

src/welcome/admin.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import {
2828
showProNoticesOption,
2929
isPro,
3030
v2disabledBlocks,
31+
defaultBreakpoints,
3132
} from 'stackable'
3233
import classnames from 'classnames'
3334
import { importBlocks } from '~stackable/util/admin'
@@ -838,7 +839,7 @@ const Responsiveness = props => {
838839
},
839840
} )
840841
} }
841-
placeholder="1024"
842+
placeholder={ defaultBreakpoints.tablet || '1024' }
842843
> px</AdminTextSetting>
843844
<AdminTextSetting
844845
label={ __( 'Mobile Breakpoint', i18n ) }
@@ -853,7 +854,7 @@ const Responsiveness = props => {
853854
},
854855
} )
855856
} }
856-
placeholder="768"
857+
placeholder={ defaultBreakpoints.mobile || '768' }
857858
> px</AdminTextSetting>
858859
</div>
859860
}

0 commit comments

Comments
 (0)