diff --git a/core/lib/Drupal/Core/Block/Plugin/Block/PageTitleBlock.php b/core/lib/Drupal/Core/Block/Plugin/Block/PageTitleBlock.php index 45899733e36..af1fb6ee374 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 @@ use Drupal\Core\Block\TitleBlockPluginInterface; * @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 17dd88e95ee..04f8bcbab6e 100644 --- a/core/modules/help/src/Plugin/Block/HelpBlock.php +++ b/core/modules/help/src/Plugin/Block/HelpBlock.php @@ -15,7 +15,10 @@ use Symfony\Component\HttpFoundation\Request; * * @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 bb2e36c4d94..c3adfd2d043 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 208e1efc5dd..87b40ac66b1 100644 --- a/core/modules/settings_tray/settings_tray.module +++ b/core/modules/settings_tray/settings_tray.module @@ -9,8 +9,6 @@ use Drupal\Core\Asset\AttachedAssetsInterface; use Drupal\Core\Routing\RouteMatchInterface; use Drupal\Core\Url; use Drupal\settings_tray\Block\BlockEntityOffCanvasForm; -use Drupal\settings_tray\Form\SystemBrandingOffCanvasForm; -use Drupal\settings_tray\Form\SystemMenuOffCanvasForm; use Drupal\block\entity\Block; use Drupal\block\BlockInterface; @@ -168,47 +166,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 94c80526482..35e683080dc 100644 --- a/core/modules/settings_tray/src/Form/SystemBrandingOffCanvasForm.php +++ b/core/modules/system/src/Form/SystemBrandingOffCanvasForm.php @@ -1,6 +1,6 @@ .toolbar-icon.toolbar-icon-edit.toolbar-item, +.toolbar-tab > .toolbar-icon.toolbar-icon-edit.toolbar-item.is-active, +.toolbar-tab > .toolbar-icon.toolbar-icon-edit.toolbar-item:focus { + background-color: #0066a1; + background-image: linear-gradient(to bottom, #0066a1, #005b98); + color: #eee; + text-shadow: none; + font-weight: bold; + outline: none; +} +/* Make the hover of the inactive state the same as the active state. */ +.toolbar-tab > .toolbar-icon.toolbar-icon-edit.toolbar-item:hover, +.toolbar-tab > .toolbar-icon.toolbar-icon-edit.toolbar-item.is-active { + background-image: linear-gradient(to bottom, #0a7bc1, #0a6eb4); + color: #fff; +} +/* Make the hover of the active state the same as the inactive state. */ +.toolbar-tab > .toolbar-icon.toolbar-icon-edit.toolbar-item.is-active:hover { + background-color: #0066a1; + background-image: linear-gradient(to bottom, #0066a1, #005b98); + color: #fff; +} +/* Make the inactive icon grey. */ +.toolbar-tab > .toolbar-icon.toolbar-icon-edit.toolbar-item:before { + background-image: url(../../../misc/icons/bebebe/pencil.svg); +} +/* Make the active icon white. */ +.toolbar-tab > .toolbar-icon.toolbar-icon-edit.toolbar-item.is-active:before { + background-image: url(../../../misc/icons/ffffff/pencil.svg); +} +.toolbar-tab > .toolbar-icon.toolbar-icon-edit.toolbar-item:hover:before { + background-image: url(../../../misc/icons/ffffff/pencil.svg); +} +.toolbar-tab > .toolbar-icon.toolbar-icon-edit.toolbar-item:hover > .toolbar-icon-edit:before { + background-image: url(../../../misc/icons/ffffff/pencil.svg); +} +.toolbar-tab > .button.toolbar-icon.toolbar-icon.toolbar-icon-edit:before { + background-image: url(../../../misc/icons/ffffff/pencil.svg); +} + +/* Style the editables while in edit mode. */ +.dialog-off-canvas-main-canvas.js-settings-tray-edit-mode .settings-tray-editable { + outline: 1px dashed rgba(0, 0, 0, 0.5); + box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.7); +} +.dialog-off-canvas-main-canvas.js-settings-tray-edit-mode .settings-tray-editable:hover, +.dialog-off-canvas-main-canvas.js-settings-tray-edit-mode .settings-tray-editable.settings-tray-active-editable { + background-color: rgba(0, 0, 0, 0.2); +} diff --git a/core/themes/stable/css/settings_tray/settings_tray.toolbar.css b/core/themes/stable/css/settings_tray/settings_tray.toolbar.css new file mode 100644 index 00000000000..4d4880e37a7 --- /dev/null +++ b/core/themes/stable/css/settings_tray/settings_tray.toolbar.css @@ -0,0 +1,66 @@ +/** + * @file + * Visual styling for the toolbar when Settings Tray module is enabled. + */ + +/* @todo Move this into toolbar when module is not experimental: + * https://www.drupal.org/node/2784593. + */ + +/* Style the edit mode toolbar and tabs. */ +#toolbar-bar.js-settings-tray-edit-mode { + background-color: #fff; +} +#toolbar-bar.js-settings-tray-edit-mode .toolbar-item { + color: #999; +} +#toolbar-bar.js-settings-tray-edit-mode .toolbar-item .is-active { + color: #333; +} + +/* Style both the edit and editing states of the contextual links toggle tab. */ +.toolbar-icon-edit.toolbar-item { + background-color: #0066a1; + background-image: linear-gradient(to bottom, #0066a1, #005b98); + color: #eee; + text-shadow: 0 1px hsla(0, 0%, 0%, 0.5); + font-weight: 700; + -webkit-font-smoothing: antialiased; +} +.toolbar-icon-edit.toolbar-item.is-active { + background-color: #0a7bc1; + background-image: linear-gradient(to bottom, #0a7bc1, #0a6eb4); + color: #fff; + text-shadow: 0 1px hsla(0, 0%, 0%, 0.5); + font-weight: 700; + -webkit-font-smoothing: antialiased; +} +.toolbar-tab:hover > .toolbar-icon-edit, +.toolbar-icon-edit:focus .toolbar-item { + background-color: #0a7bc1; + background-image: linear-gradient(to bottom, #0a7bc1, #0a6eb4); + border-color: #1e5c90; + color: #fff; + outline: none; +} +.toolbar-icon.toolbar-icon-edit.toolbar-item:before, +button.toolbar-icon.toolbar-icon-edit.toolbar-item:before { + background-image: url(../../../misc/icons/bebebe/pencil.svg); +} +.toolbar-icon.toolbar-icon-edit.toolbar-item:before:hover, +button.toolbar-icon.toolbar-icon-edit.toolbar-item:before:focus { + background-image: url(../../../misc/icons/ffffff/pencil.svg); +} +.toolbar-icon.toolbar-icon-edit.toolbar-item:hover > .toolbar-icon-edit:before { + background-image: url(../../../misc/icons/ffffff/pencil.svg); +} +#toolbar-bar.button.toolbar-icon.toolbar-icon.toolbar-icon-edit:before { + background-image: url(../../../misc/icons/ffffff/pencil.svg); +} + +#toolbar-bar.js-settings-tray-edit-mode button.toolbar-icon.toolbar-icon-edit.toolbar-item.is-active { + color: #fff; +} +#toolbar-bar.js-settings-tray-edit-mode button.toolbar-icon.toolbar-icon-edit.toolbar-item.is-active:hover { + background-image: linear-gradient(to bottom, #0a6fb4, #0a65aa); +} diff --git a/core/themes/stable/stable.info.yml b/core/themes/stable/stable.info.yml index 3f019d065b8..04110695bab 100644 --- a/core/themes/stable/stable.info.yml +++ b/core/themes/stable/stable.info.yml @@ -169,6 +169,15 @@ libraries-override: css/quickedit.theme.css: css/quickedit/quickedit.theme.css css/quickedit.icons.theme.css: css/quickedit/quickedit.icons.theme.css + settings_tray/drupal.settings_tray: + css: + component: + css/settings_tray.module.css: css/settings_tray/settings_tray.module.css + css/settings_tray.motion.css: css/settings_tray/settings_tray.motion.css + css/settings_tray.toolbar.css: css/settings_tray/settings_tray.toolbar.css + theme: + css/settings_tray.theme.css: css/settings_tray/settings_tray.theme.css + shortcut/drupal.shortcut: css: theme: