I would like to override the container.html.twig template but the twig debugging tool doesn't give any suggestion.
I tried to add suggestion following https://drupal.stackexchange.com/a/249565/85029 answer but I end up with the suggestion being container----.html.twig.
The context is a display field with an embed view in a node.
I guess, the solution might be pretty close from what I have now (using the suggestion hook) but I'm not able to have some satisfying suggestion.
My current hook is
function mytheme_theme_suggestions_container_alter(&$suggestions, array $variables) {
$element = $variables['element'];
if (isset($element['#type']) && $element['#type'] == 'view') {
$suggestions[] = 'container__' . $element['#name'];
$suggestions[] = 'container__' . $element['#name'] . '__' . $element['#display_id'];
}
if (isset($element['#type']) && $element['#type'] == 'container' && isset($element['children']['#type'])) {
$suggestions[] = 'container__' . $element['children']['#type'];
}
}
Edit :
Ended up with something corresponding to my expectations by adding
if (isset($element[0]) && $element[0]["#theme"]) {
foreach ($element[0]["#theme"] as $themElem) {
$suggestions[] = 'container__' . $themElem;
}
}