I am trying to set a custom theme suggestion for the item-list template. It does work but I am getting an error message:
User error: "attributes" is an invalid render array key in Drupal\Core\Render\Element::children() (line 97 of core/lib/Drupal/Core/Render/Element.php).
Function:
function MYTHEME_theme_suggestions_item_list_alter(array &$suggestions, array $variables) {
$moduleclass = str_replace('-', '_', $variables['attributes']['class']);
$suggestions[] = 'item_list__' . $moduleclass;
}
Not sure what the probleme is here?