block_theme_initialize should not create blocks during config sync

Created on 16 November 2020, almost 4 years ago
Updated 30 October 2023, 10 months ago

Problem/Motivation

This is a follow-up for #2404105: When a profile installs a block for a theme, it is created for all enabled themes β†’ .

There we found out when you install a site with some themes enabled. And then add for example claro to the core.extensions file and execute a drush cim. Then block_theme_initialize creates some blocks, but they get immediately deleted.

$ drush cim                                                                                                                                (9.2.x|✚6…)
+------------+----------------+-----------+
| Collection | Config         | Operation |
+------------+----------------+-----------+
|            | core.extension | Update    |
+------------+----------------+-----------+

 Import the listed configuration changes? (yes/no) [yes]:
 > y

 [notice] Synchronized extensions: install claro.
 [notice] Synchronized configuration: delete block.block.claro_tools.
 [notice] Synchronized configuration: delete block.block.claro_main_menu.
 [notice] Synchronized configuration: delete block.block.claro_footer.
 [notice] Synchronized configuration: delete block.block.claro_account_menu.
 [notice] Synchronized configuration: delete block.block.claro_branding.
 [notice] Synchronized configuration: delete block.block.claro_breadcrumbs.
 [notice] Synchronized configuration: delete block.block.claro_content.
 [notice] Synchronized configuration: delete block.block.claro_messages.
 [notice] Synchronized configuration: delete block.block.claro_powered.
 [notice] Synchronized configuration: delete block.block.claro_search.
 [notice] Synchronized configuration: delete block.block.claro_help.
 [notice] Synchronized configuration: delete claro.settings.
 [notice] Synchronized configuration: delete block.block.claro_local_actions.
 [notice] Synchronized configuration: delete block.block.claro_local_tasks.
 [notice] Synchronized configuration: delete block.block.claro_page_title.
 [notice] Finalizing configuration synchronization.
 [success] The configuration was imported successfully.

Proposed resolution

block_theme_initialize should not run, so that there is no need to delete these created blocks.

πŸ› Bug report
Status

Needs work

Version

11.0 πŸ”₯

Component
BlockΒ  β†’

Last updated 3 days ago

Created by

πŸ‡©πŸ‡ͺGermany chr.fritsch πŸ‡©πŸ‡ͺπŸ‡ͺπŸ‡ΊπŸŒ

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ͺπŸ‡ΈSpain rcodina

    I ended up here because I'm doing a migration from core 9.5.11 to 10.1.5. On 9.5.11 we had Adminimal theme as admin theme and now we are enabling and configuring the Claro theme. The enabled Claro blocks are all set in yml config files. The problem is that when I import the configuration using customer's environment database the following error shows up:

    In EntityStorageBase.php line 519:                                                                                              
                                                                                                                                      
        'block' entity with ID 'claro_footer' already exists.

    Using patch on #6 it avoids the import error. However, the blocks we have set in yml files doesn't get imported. Moreover, If do a "drush cex", it deletes the claro blocks I had defined on those files:

     [notice] Differences of the active config to the export directory:
    
    +------------+-----------------------------------------+-----------+
    | Collection | Config                                  | Operation |
    +------------+-----------------------------------------+-----------+
    |            | block.block.claro_breadcrumbs           | Delete    |
    |            | block.block.claro_content               | Delete    |
    |            | block.block.claro_messages              | Delete    |
    |            | block.block.claro_local_actions         | Delete    |
    |            | block.block.claro_page_title            | Delete    |
    |            | block.block.claro_primary_local_tasks   | Delete    |
    |            | block.block.claro_secondary_local_tasks | Delete    |
    +------------+-----------------------------------------+-----------+

    Why they get deleted?

Production build 0.71.5 2024