diff --git a/core/themes/claro/claro.theme b/core/themes/claro/claro.theme index a3eee603df..0380bdfbd6 100644 --- a/core/themes/claro/claro.theme +++ b/core/themes/claro/claro.theme @@ -825,10 +825,12 @@ function claro_preprocess_field_multiple_value_form(&$variables) { if ($variables['multiple']) { // Add an additional CSS class to the field label table cell. The table - // header cell exists always in a multiple value field. + // header cell should always exist unless removed by contrib. // @see template_preprocess_field_multiple_value_form(). - $variables['table']['#header'][0]['data']['#attributes']['class'][] = 'form-item__label'; - $variables['table']['#header'][0]['data']['#attributes']['class'][] = 'form-item__label--multiple-value-form'; + if (isset($variables['table']['#header'][0]['data']['#attributes']) && $variables['table']['#header'][0]['data']['#attributes'] instanceof Attribute) { + $variables['table']['#header'][0]['data']['#attributes']->removeClass('label'); + $variables['table']['#header'][0]['data']['#attributes']->addClass('form-item__label', 'form-item__label--multiple-value-form'); + } if ($variables['disabled']) { $variables['table']['#attributes']['class'][] = 'tabledrag-disabled';