0

On my site, I have created a sub-theme of a sub-theme using this as a guide to set this up https://www.drupal.org/docs/8/theming-drupal-8/creating-a-drupal-8-sub-theme-or-sub-theme-of-sub-theme and it does work with carrying over all of the css/js/regions but for some reason, it is renaming all of the blocks with the prefix of the sub-theme.

So, for example, I have a block with a machine name of mainnavigation when I install/set as default the sub-theme it will change this block to theme3_mainnavigation.

I have tried removing the block and placing it back in with the same name of mainnavigation but I run into an issue where a message will appear that says this machine name already exists.

Does anyone know how to get around this so the sub-theme will use the machine names of already existing names instead of creating a prefix?

Thanks for any help!

1 Answer 1

0

You can't.

This behavior is core functionality from the Block module that's enforcing its data model. Each time you place a block, you're creating a unique Block entity that has a theme property tied to it. Thus, the mainnavigation block entity can't simultaneously be used on the default theme as well as theme3.

This is why Drupal defaults to generating ${theme_machine_name}_${block_machine_name} so the user doesn't have to think about it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.