function FieldTestHooks::fieldWidgetSingleElementFormAlter

Implements hook_field_widget_single_element_form_alter().

File

core/modules/field/tests/modules/field_test/src/Hook/FieldTestHooks.php, line 35

Class

FieldTestHooks
Hook implementations for field_test.

Namespace

Drupal\field_test\Hook

Code

public function fieldWidgetSingleElementFormAlter(&$element, FormStateInterface $form_state, $context) : void {
    // 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.