function OptionsTestHooks::formEntityTestEntityTestFormAlter

Same name and namespace in other branches
  1. 11.x core/modules/options/tests/options_test/src/Hook/OptionsTestHooks.php \Drupal\options_test\Hook\OptionsTestHooks::formEntityTestEntityTestFormAlter()

Implements hook_form_FORM_ID_alter().

Attributes

#[Hook('form_entity_test_entity_test_form_alter')]

File

core/modules/options/tests/options_test/src/Hook/OptionsTestHooks.php, line 18

Class

OptionsTestHooks
Hook implementations for options_test.

Namespace

Drupal\options_test\Hook

Code

public function formEntityTestEntityTestFormAlter(&$form, FormStateInterface $form_state, $form_id) : void {
  if (\Drupal::state()->get('options_test.form_alter_enable', FALSE)) {
    $form['card_1']['widget']['#required_error'] = 'This is custom message for required field.';
  }
}

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