Problem/Motivation
During theme initialization, block_theme_initialize() copies over existing blocks and gives them a machine name prefixed with the theme name. This severs the link between the blocks in the subtheme and their twig templates.
Proposed resolution
Given a block named "mysubtheme-myblock" we check the current theme for "block--mysubtheme-myblock.html.twig" as we do currently, then look for "block--myblock.html.twig" in the parent, then resume the current order of possible theme names for a match. This is complicated though by block names containing an underscore or dash. It might be necessary for blocks to be aware of their compliment in the parent theme, if any, if that isn't in place already.
Comments
Comment #2
Aki Tendo CreditAttribution: Aki Tendo commentedI found a workaround using the hook system
Change "MYTHEME" to the theme, and place this function in the subtheme to enable it to inherit correctly.
Comment #3
nesta_ CreditAttribution: nesta_ at La Drupalera by Emergya commentedComment #4
nesta_ CreditAttribution: nesta_ at La Drupalera by Emergya commentedI dont know what would be the best way to do it, I think you should discuss the suggestions.
I un-assign the task and change to Need Work.
Comment #5
Aki Tendo CreditAttribution: Aki Tendo commentedI'm not sure either, or at least of a fix that would be backwards compatible. I don't think blocks track their copies in a parent theme when they are cloned.
For the moment I think I'll add this hook implementation to the documentation for creating subthemes.
Comment #17
DanielVezaThis feels like a feature request - Can we get a list of steps to reproduce?
Comment #19
smustgrave CreditAttribution: smustgrave at Mobomo commentedDoesn't appear to have been any follow up since #17. Going to close out for now, if still a valid request please reopen.