From dbc86804a7bceda23f42741396713979efc502f8 Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Fri, 28 Jul 2017 10:26:23 +0100 Subject: [PATCH] Theme Support: use a unique `gutenberg` key for all the gutenberg theme support features --- docs/themes.md | 4 +++- lib/client-assets.php | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/themes.md b/docs/themes.md index 097b096d0ee43..5ef859863798a 100644 --- a/docs/themes.md +++ b/docs/themes.md @@ -11,5 +11,7 @@ Some advanced block features require opt-in support in the theme itself as it's Some blocks such as the image block have the possibility to define a "wide" or "full" alignment by adding the corresponding classname to the block's wrapper ( `alignwide` or `alignfull` ). A theme can opt-in for this feature by calling: ```php -add_theme_support( 'wide-images' ); +add_theme_support( 'gutenberg', array( + 'wide-images' => true, +) ); ``` diff --git a/lib/client-assets.php b/lib/client-assets.php index 098cf7388d470..de0c5f5dad239 100644 --- a/lib/client-assets.php +++ b/lib/client-assets.php @@ -611,8 +611,9 @@ function gutenberg_editor_scripts_and_styles( $hook ) { ); // Initialize the editor. + $gutenberg_theme_support = get_theme_support( 'gutenberg' ); $editor_settings = array( - 'wideImages' => get_theme_support( 'wide-images' ), + 'wideImages' => $gutenberg_theme_support ? $gutenberg_theme_support[0]['wide-images'] : false, ); wp_add_inline_script( 'wp-editor', 'wp.api.init().done( function() {' . 'wp.editor.createEditorInstance( \'editor\', window._wpGutenbergPost, ' . json_encode( $editor_settings ) . ' ); '