function template_preprocess_entity_extra_field in Entity Extra Field 8
Same name and namespace in other branches
- 2.0.x templates/entity_extra_field.theme \template_preprocess_entity_extra_field()
The template entity extra field preprocess.
File
- templates/
entity_extra_field.theme, line 13 - The theme implementation for the entity extra field.
Code
function template_preprocess_entity_extra_field(&$variables) {
$element = $variables['element'];
$extra_field = $element['#field'];
$variables['label'] = $element['label'];
$variables['content'] = $element['content'];
$variables['attributes']['class'][] = 'extra-field';
if ($extra_field instanceof EntityExtraFieldInterface) {
$field_class_name = entity_extra_field_class_string([
$extra_field
->name(),
]);
$variables['attributes']['class'][] = 'extra-field--' . $field_class_name;
$variables['attributes']['class'][] = 'extra-field--type-' . $extra_field
->getFieldTypePluginId();
}
$variables['title_attributes']['class'][] = 'extra-field--label';
$variables['content_attributes']['class'][] = 'extra-field--content';
}