Skip to content

Commit

Permalink
new feature: hide border radius by default. also alphabetize list of …
Browse files Browse the repository at this point in the history
…hidden features. closes #7
  • Loading branch information
mrwweb committed Nov 12, 2021
1 parent 882f251 commit 5268961
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions inc/block-editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -340,16 +340,17 @@ function mrw_hidden_block_styles() {
function mrw_hidden_block_editor_settings() {

$hidden_block_editor_settings = array(
'block-directory',
'border-radius',
'default-style-variation',
'drop-cap',
'image-file-upload',
'image-url',
'heading-1',
'heading-5',
'heading-6',
'image-dimensions',
'image-file-upload',
'image-url',
'new-tabs',
'block-directory',
'default-style-variation'
);

$hidden_block_editor_settings = apply_filters_deprecated(
Expand Down Expand Up @@ -379,7 +380,7 @@ function mrw_hidden_block_editor_settings() {
if( version_compare( get_bloginfo( 'version' ), '5.8', '<' ) ) {
add_filter( 'block_editor_settings', 'mrw_block_editor_settings' );
} else {
add_filter( 'block_editor_settings_all', 'mrw_block_editor_settings' );
add_filter( 'block_editor_settings_all', 'mrw_block_editor_settings', 10, 2 );
}
/**
* Make changes to editor settings, accounting for plugin filters, via the core block_editor_settings filter
Expand All @@ -389,7 +390,7 @@ function mrw_hidden_block_editor_settings() {
*
* @see https://github.com/joppuyo/remove-drop-cap/blob/v1.1.0/remove-drop-cap.php#L22
*/
function mrw_block_editor_settings( $editor_settings ) {
function mrw_block_editor_settings( $editor_settings, $context ) {

$hidden_settings = mrw_hidden_block_editor_settings();

Expand All @@ -400,6 +401,10 @@ function mrw_block_editor_settings( $editor_settings ) {
$editor_settings['__experimentalFeatures']['typography']['dropCap'] = false;
}

if( in_array( 'border-radius', $hidden_settings) ) {
$editor_settings['__experimentalFeatures']['blocks']['core/button']['border']['customRadius'] = false;
}

return $editor_settings;

}
Expand Down

0 comments on commit 5268961

Please sign in to comment.