diff --git a/core/lib/Drupal/Core/Block/Plugin/Block/PageTitleBlock.php b/core/lib/Drupal/Core/Block/Plugin/Block/PageTitleBlock.php index 45899733e3..af1fb6ee37 100644 --- a/core/lib/Drupal/Core/Block/Plugin/Block/PageTitleBlock.php +++ b/core/lib/Drupal/Core/Block/Plugin/Block/PageTitleBlock.php @@ -11,6 +11,9 @@ * @Block( * id = "page_title_block", * admin_label = @Translation("Page title"), + * forms = { + * "settings_tray" = FALSE, + * }, * ) */ class PageTitleBlock extends BlockBase implements TitleBlockPluginInterface { diff --git a/core/modules/help/src/Plugin/Block/HelpBlock.php b/core/modules/help/src/Plugin/Block/HelpBlock.php index 17dd88e95e..04f8bcbab6 100644 --- a/core/modules/help/src/Plugin/Block/HelpBlock.php +++ b/core/modules/help/src/Plugin/Block/HelpBlock.php @@ -15,7 +15,10 @@ * * @Block( * id = "help_block", - * admin_label = @Translation("Help") + * admin_label = @Translation("Help"), + * forms = { + * "settings_tray" = FALSE, + * }, * ) */ class HelpBlock extends BlockBase implements ContainerFactoryPluginInterface { diff --git a/core/modules/settings_tray/settings_tray.info.yml b/core/modules/settings_tray/settings_tray.info.yml index bb2e36c4d9..c3adfd2d04 100644 --- a/core/modules/settings_tray/settings_tray.info.yml +++ b/core/modules/settings_tray/settings_tray.info.yml @@ -1,7 +1,7 @@ name: 'Settings Tray' type: module description: 'Provides a sidebar to configure blocks on the page.' -package: Core (Experimental) +package: Core version: VERSION core: 8.x dependencies: diff --git a/core/modules/settings_tray/settings_tray.module b/core/modules/settings_tray/settings_tray.module index 208e1efc5d..114b4d9b2c 100644 --- a/core/modules/settings_tray/settings_tray.module +++ b/core/modules/settings_tray/settings_tray.module @@ -168,47 +168,10 @@ function settings_tray_toolbar_alter(&$items) { */ function settings_tray_block_alter(&$definitions) { foreach ($definitions as &$definition) { - // If a block plugin already defines its own 'settings_tray' form, use that - // form instead of specifying one here. - if (isset($definition['forms']['settings_tray'])) { - continue; - } - - switch ($definition['id']) { - // Use specialized forms for certain blocks that do not yet provide the - // form with their own annotation. - // @todo Move these into the corresponding block plugin annotations in - // https://www.drupal.org/node/2896356. - case 'system_menu_block': - $definition['forms']['settings_tray'] = SystemMenuOffCanvasForm::class; - break; - - case 'system_branding_block': - $definition['forms']['settings_tray'] = SystemBrandingOffCanvasForm::class; - break; - - // No off-canvas form for the page title block, despite it having - // contextual links: it's too confusing that you're editing configuration, - // not content, so the title itself cannot actually be changed. - // @todo Move these into the corresponding block plugin annotations in - // https://www.drupal.org/node/2896356. - case 'page_title_block': - $definition['forms']['settings_tray'] = FALSE; - break; - - case 'system_main_block': - $definition['forms']['settings_tray'] = FALSE; - break; - - case 'help_block': - $definition['forms']['settings_tray'] = FALSE; - break; - - // Otherwise, use the block plugin's normal form rather than - // a custom form for Settings Tray. - default: - $definition['forms']['settings_tray'] = $definition['class']; - break; + // If a block plugin does not define its own 'settings_tray' form, use the + // plugin class itself. + if (!isset($definition['forms']['settings_tray'])) { + $definition['forms']['settings_tray'] = $definition['class']; } } } diff --git a/core/modules/settings_tray/src/Form/SystemBrandingOffCanvasForm.php b/core/modules/system/src/Form/SystemBrandingOffCanvasForm.php similarity index 96% rename from core/modules/settings_tray/src/Form/SystemBrandingOffCanvasForm.php rename to core/modules/system/src/Form/SystemBrandingOffCanvasForm.php index 94c8052648..35e683080d 100644 --- a/core/modules/settings_tray/src/Form/SystemBrandingOffCanvasForm.php +++ b/core/modules/system/src/Form/SystemBrandingOffCanvasForm.php @@ -1,6 +1,6 @@