0

Not sure if this is a silly question or not...

I am using Drupal 8.

I was messing around with a sub-theme to a custom theme I am making. For now, the sub-theme has almost nothing in it and all the same regions as the custom parent theme.

When I swapped back to the parent theme as the running theme it dumped all my blocks into the header (ok, annoying but fine) but it also removed a number of blocks I had created.

For example, I had created several copies of the 'Site Branding' block with different settings which I then gave custom machine names to and styled with some twig template files. They were all missing but when I tried to recreate them I encountered a machine name already in use error.

Is there a way to avoid this happening or having the machine names also be removed when the theme changes?

Ultimately, once the theme and base theme and an accompanying module are complete I plan to properly install and uninstall all these blocks programmatically but while I am experimenting I would like to be able to switch themes without breaking all my template files.

  • When you swapped back to the parent theme you installed this theme again? – 4k4 Jun 14 '18 at 7:30
  • they were both installed, I just swapped which was the default theme. – tanbog Jun 15 '18 at 3:27
  • Sorry forgot to add, when i swap back to the other theme the blocks reappear. This issue is I would like to use them on both themes while testing but the machine name does not seem to be available on the theme where they were not created. – tanbog Jun 15 '18 at 5:35
  • 1
    OK, when you don't reinstall, the described dumping of blocks shouldn't happen. Concerning the machine names configured blocks are specific to a theme and Drupal suggests machine names prefixed by the theme name if the machine name is already in use. – 4k4 Jun 15 '18 at 18:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.