I have a block for the language switcher. I want to override the links in it. I can override a specific language switcher block's markup, and I can override the links markup in all language switcher blocks, but I can't override "$links markup in language switcher block delta 1".
Do I have to use a template suggestion to do this? If so, how should I approach this? With the core templates, I've tried to dig down with: blocks, into links, but only get as far as {{ content }}
; and go up with links into blocks, but I can't be specific and target a block that way.
Current templates I've got:
- block--languageswitcher.html.twig (targets block with delta 1, but can't theme links)
- links--language-block.html.twig (targets links in all switchers, unspecific)
Use case: Specifically, I'm trying to override the switcher so I can have country codes in an inline list instead of country names in an unordered list. e.g. EN | FR | IT Obviously, I could overwrite all the switcher blocks but it doesn't seem right; it's certainly inelegant.
block
andlinks__language_block
. Those two yield quite a bit of info that might be able to be leveraged in a theme hook suggestion alter.function MYTHEME_preprocess_links__language_block(&$vars) { kint($vars); }
. That should yield a good amount of info and you can do that for block too. You can then create theme hooks withMYTHEME_theme_suggestions_[THE_HOOK]_alter
. Sorry I don't have a specific answer for you but that's how I would approach it. I've written a few posts about this on my blog.