Same name and namespace in other branches
  1. 8.9.x core/modules/system/tests/modules/entity_test/entity_test.module \entity_test_entity_form_display_alter()
  2. 9 core/modules/system/tests/modules/entity_test/entity_test.module \entity_test_entity_form_display_alter()

Implements hook_entity_form_display_alter().

File

core/modules/system/tests/modules/entity_test/entity_test.module, line 456
Test module for the entity API providing several entity types for testing.

Code

function entity_test_entity_form_display_alter(EntityFormDisplay $form_display, $context) {

  // 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);
    }
  }
}