.../modules/system/config/schema/system.schema.yml | 11 +++++++ .../system/src/Plugin/Block/SystemMenuBlock.php | 38 +++++++++++----------- 2 files changed, 30 insertions(+), 19 deletions(-) diff --git a/core/modules/system/config/schema/system.schema.yml b/core/modules/system/config/schema/system.schema.yml index 2e9219d..46198c1 100644 --- a/core/modules/system/config/schema/system.schema.yml +++ b/core/modules/system/config/schema/system.schema.yml @@ -375,6 +375,17 @@ block.settings.system_branding_block: type: boolean label: 'Use site slogan' +block.settings.system_menu_block: + type: block_settings + label: 'Branding block' + mapping: + level: + type: integer + label: 'Starting level' + depth: + type: integer + label: 'Maximum number of levels' + condition.plugin.request_path: type: condition.plugin mapping: diff --git a/core/modules/system/src/Plugin/Block/SystemMenuBlock.php b/core/modules/system/src/Plugin/Block/SystemMenuBlock.php index 545f896..26677d6 100644 --- a/core/modules/system/src/Plugin/Block/SystemMenuBlock.php +++ b/core/modules/system/src/Plugin/Block/SystemMenuBlock.php @@ -78,25 +78,6 @@ public static function create(ContainerInterface $container, array $configuratio /** * {@inheritdoc} */ - public function defaultConfiguration() { - // Modify the default max age for menu blocks: modifications made to menus, - // menu links and menu blocks will automatically invalidate corresponding - // cache tags, therefore allowing us to cache menu blocks forever. This is - // only not the case if there are user-specific or dynamic alterations (e.g. - // hook_node_access()), but in that: - // 1) it is possible to set a different max age for individual blocks, since - // this is just the default value. - // 2) modules can modify caching by implementing hook_block_view_alter() - return array( - 'cache' => array('max_age' => \Drupal\Core\Cache\Cache::PERMANENT), - 'level' => 1, - 'depth' => 0, - ); - } - - /** - * {@inheritdoc} - */ public function blockForm($form, FormStateInterface $form_state) { $config = $this->configuration; @@ -173,6 +154,25 @@ public function build() { /** * {@inheritdoc} */ + public function defaultConfiguration() { + // Modify the default max age for menu blocks: modifications made to menus, + // menu links and menu blocks will automatically invalidate corresponding + // cache tags, therefore allowing us to cache menu blocks forever. This is + // only not the case if there are user-specific or dynamic alterations (e.g. + // hook_node_access()), but in that: + // 1) it is possible to set a different max age for individual blocks, since + // this is just the default value. + // 2) modules can modify caching by implementing hook_block_view_alter() + return array( + 'cache' => array('max_age' => \Drupal\Core\Cache\Cache::PERMANENT), + 'level' => 1, + 'depth' => 0, + ); + } + + /** + * {@inheritdoc} + */ public function getCacheKeys() { // Add a key for the active menu trail. $menu = $this->getDerivativeId();