function field_test_entity_display_build_alter
Same name in other branches
- 9 core/modules/field/tests/modules/field_test/field_test.module \field_test_entity_display_build_alter()
- 10 core/modules/field/tests/modules/field_test/field_test.module \field_test_entity_display_build_alter()
- 11.x core/modules/field/tests/modules/field_test/field_test.module \field_test_entity_display_build_alter()
Implements hook_entity_display_build_alter().
1 string reference to 'field_test_entity_display_build_alter'
- DisplayApiTest::testFieldItemListView in core/
modules/ field/ tests/ src/ Kernel/ DisplayApiTest.php - Tests the FieldItemListInterface::view() method.
File
-
core/
modules/ field/ tests/ modules/ field_test/ field_test.module, line 90
Code
function field_test_entity_display_build_alter(&$output, $context) {
$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.