function EntityTestHooks::entityFormDisplayAlter
Same name and namespace in other branches
- 11.x core/modules/system/tests/modules/entity_test/src/Hook/EntityTestHooks.php \Drupal\entity_test\Hook\EntityTestHooks::entityFormDisplayAlter()
Implements hook_entity_form_display_alter().
Attributes
#[Hook('entity_form_display_alter')]
File
-
core/
modules/ system/ tests/ modules/ entity_test/ src/ Hook/ EntityTestHooks.php, line 365
Class
- EntityTestHooks
- Hook implementations for entity_test.
Namespace
Drupal\entity_test\HookCode
public function entityFormDisplayAlter(EntityFormDisplay $form_display, $context) : void {
// Make the field_test_text field 42 characters for entity_test_mul.
if ($context['entity_type'] == 'entity_test') {
if ($component_options = $form_display->getComponent('field_test_text')) {
$component_options['settings']['size'] = 42;
$form_display->setComponent('field_test_text', $component_options);
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.