function field_test_field_widget_single_element_form_alter

Same name in other branches
  1. 10 core/modules/field/tests/modules/field_test/field_test.module \field_test_field_widget_single_element_form_alter()
  2. 11.x core/modules/field/tests/modules/field_test/field_test.module \field_test_field_widget_single_element_form_alter()

Implements hook_field_widget_single_element_form_alter().

File

core/modules/field/tests/modules/field_test/field_test.module, line 103

Code

function field_test_field_widget_single_element_form_alter(&$element, FormStateInterface $form_state, $context) {
    // Set a message if this is for the form displayed to set default value for
    // the field.
    if ($context['default']) {
        \Drupal::messenger()->addStatus('From hook_field_widget_single_element_form_alter(): Default form is true.');
    }
}

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