function entity_test_entity_form_display_alter

Same name in other branches
  1. 9 core/modules/system/tests/modules/entity_test/entity_test.module \entity_test_entity_form_display_alter()
  2. 8.9.x core/modules/system/tests/modules/entity_test/entity_test.module \entity_test_entity_form_display_alter()
  3. 11.x 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

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.