function 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 355

Class

EntityTestHooks
Hook implementations for entity_test.

Namespace

Drupal\entity_test\Hook

Code

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.