function FieldTestHooks::entityDisplayBuildAlter
Implements hook_entity_display_build_alter().
File
-
core/
modules/ field/ tests/ modules/ field_test/ src/ Hook/ FieldTestHooks.php, line 21
Class
- FieldTestHooks
- Hook implementations for field_test.
Namespace
Drupal\field_test\HookCode
public function entityDisplayBuildAlter(&$output, $context) : void {
$display_options = $context['display']->getComponent('test_field');
if (isset($display_options['settings']['alter'])) {
$output['test_field'][] = [
'#markup' => 'field_test_entity_display_build_alter',
];
}
if (isset($output['test_field'])) {
$output['test_field'][] = [
'#markup' => 'entity language is ' . $context['entity']->language()
->getId(),
];
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.