I have a custom theme that has base theme: classy
setting in the mytheme.info.yml
file. When we enable twig debugging locally, we find that the <!-- BEGIN OUTPUT from 'themes/custom/mytheme/templates/navigation/breadcrumb.html.twig' -->
is displayed, but there are no theme suggestions available.
This is what displayed on the page.
How can we create theme suggestions for breadcrumbs?
We tried the following in the mytheme.theme
file, but it did not print out the ksm()
statements.
function mytheme_theme_suggestions_breadcrumb_alter(array &$suggestions, array $variables) {
ksm($suggestions); // this returns empty
ksm($variables); // this only returns theme_hook_suggestion and links array
}
The code is based off of what we can do for block suggestions alters.
function mytheme_theme_suggestions_block_alter(array &$suggestions, array $variables) {
if (isset($variables['elements']['content']['#block_content'])) {
$suggestions[] = 'block__' . $variables['elements']['content']['#block_content']->bundle();
}
}