Loading core/modules/block/block.module +29 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ */ use Drupal\Component\Utility\Html; use Drupal\Core\Installer\InstallerKernel; use Drupal\Core\Routing\RouteMatchInterface; use Drupal\Core\Link; use Drupal\Core\Url; Loading Loading @@ -86,8 +87,18 @@ function block_page_top(array &$page_top) { * * @param $theme_list * An array of theme names. * * @see block_modules_installed() */ function block_themes_installed($theme_list) { // Disable this functionality prior to install profile installation because // block configuration is often optional or provided by the install profile // itself. block_theme_initialize() will be called when the install profile is // installed. if (InstallerKernel::installationAttempted() && \Drupal::config('core.extension')->get('module.' . \Drupal::installProfile()) === NULL) { return; } foreach ($theme_list as $theme) { // Don't initialize themes that are not displayed in the UI. if (\Drupal::service('theme_handler')->hasUi($theme)) { Loading Loading @@ -133,6 +144,24 @@ function block_theme_initialize($theme) { } } /** * Implements hook_modules_installed(). * * @see block_themes_installed() */ function block_modules_installed($modules) { // block_themes_installed() does not call block_theme_initialize() during site // installation because block configuration can be optional or provided by the // profile. Now, when the profile is installed, this configuration exists, // call block_theme_initialize() for all installed themes. $profile = \Drupal::installProfile(); if (in_array($profile, $modules, TRUE)) { foreach (\Drupal::service('theme_handler')->listInfo() as $theme => $data) { block_theme_initialize($theme); } } } /** * Implements hook_rebuild(). */ Loading core/profiles/testing_themes_blocks/config/install/system.theme.yml 0 → 100644 +2 −0 Original line number Diff line number Diff line admin: testing_theme_optional_blocks default: testing_theme_required_blocks core/profiles/testing_themes_blocks/testing_themes_blocks.info.yml 0 → 100644 +11 −0 Original line number Diff line number Diff line name: Testing themes blocks type: profile description: 'Minimal profile for testing block installation of themes.' version: VERSION hidden: true themes: - testing_theme_optional_blocks - testing_theme_required_blocks - testing_theme_without_blocks install: - block core/profiles/testing_themes_blocks/themes/testing_theme_optional_blocks/config/optional/block.block.testing_theme_optional_blocks_page_title.yml 0 → 100644 +17 −0 Original line number Diff line number Diff line langcode: en status: true dependencies: theme: - testing_theme_optional_blocks id: testing_theme_optional_blocks_page_title theme: testing_theme_optional_blocks region: header weight: -30 provider: null plugin: page_title_block settings: id: page_title_block label: 'Page title' provider: core label_display: '0' visibility: { } core/profiles/testing_themes_blocks/themes/testing_theme_optional_blocks/testing_theme_optional_blocks.info.yml 0 → 100644 +15 −0 Original line number Diff line number Diff line name: Testing theme with optional blocks type: theme base theme: false package: Testing version: VERSION regions: header: 'Header' pre_content: 'Pre-content' breadcrumb: Breadcrumb highlighted: Highlighted help: Help content: Content page_top: 'Page top' page_bottom: 'Page bottom' sidebar_first: 'First sidebar' Loading
core/modules/block/block.module +29 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ */ use Drupal\Component\Utility\Html; use Drupal\Core\Installer\InstallerKernel; use Drupal\Core\Routing\RouteMatchInterface; use Drupal\Core\Link; use Drupal\Core\Url; Loading Loading @@ -86,8 +87,18 @@ function block_page_top(array &$page_top) { * * @param $theme_list * An array of theme names. * * @see block_modules_installed() */ function block_themes_installed($theme_list) { // Disable this functionality prior to install profile installation because // block configuration is often optional or provided by the install profile // itself. block_theme_initialize() will be called when the install profile is // installed. if (InstallerKernel::installationAttempted() && \Drupal::config('core.extension')->get('module.' . \Drupal::installProfile()) === NULL) { return; } foreach ($theme_list as $theme) { // Don't initialize themes that are not displayed in the UI. if (\Drupal::service('theme_handler')->hasUi($theme)) { Loading Loading @@ -133,6 +144,24 @@ function block_theme_initialize($theme) { } } /** * Implements hook_modules_installed(). * * @see block_themes_installed() */ function block_modules_installed($modules) { // block_themes_installed() does not call block_theme_initialize() during site // installation because block configuration can be optional or provided by the // profile. Now, when the profile is installed, this configuration exists, // call block_theme_initialize() for all installed themes. $profile = \Drupal::installProfile(); if (in_array($profile, $modules, TRUE)) { foreach (\Drupal::service('theme_handler')->listInfo() as $theme => $data) { block_theme_initialize($theme); } } } /** * Implements hook_rebuild(). */ Loading
core/profiles/testing_themes_blocks/config/install/system.theme.yml 0 → 100644 +2 −0 Original line number Diff line number Diff line admin: testing_theme_optional_blocks default: testing_theme_required_blocks
core/profiles/testing_themes_blocks/testing_themes_blocks.info.yml 0 → 100644 +11 −0 Original line number Diff line number Diff line name: Testing themes blocks type: profile description: 'Minimal profile for testing block installation of themes.' version: VERSION hidden: true themes: - testing_theme_optional_blocks - testing_theme_required_blocks - testing_theme_without_blocks install: - block
core/profiles/testing_themes_blocks/themes/testing_theme_optional_blocks/config/optional/block.block.testing_theme_optional_blocks_page_title.yml 0 → 100644 +17 −0 Original line number Diff line number Diff line langcode: en status: true dependencies: theme: - testing_theme_optional_blocks id: testing_theme_optional_blocks_page_title theme: testing_theme_optional_blocks region: header weight: -30 provider: null plugin: page_title_block settings: id: page_title_block label: 'Page title' provider: core label_display: '0' visibility: { }
core/profiles/testing_themes_blocks/themes/testing_theme_optional_blocks/testing_theme_optional_blocks.info.yml 0 → 100644 +15 −0 Original line number Diff line number Diff line name: Testing theme with optional blocks type: theme base theme: false package: Testing version: VERSION regions: header: 'Header' pre_content: 'Pre-content' breadcrumb: Breadcrumb highlighted: Highlighted help: Help content: Content page_top: 'Page top' page_bottom: 'Page bottom' sidebar_first: 'First sidebar'