function field_test_field_widget_form_alter

Same name in other branches
  1. 8.9.x core/modules/field/tests/modules/field_test/field_test.module \field_test_field_widget_form_alter()

Implements hook_field_widget_form_alter().

File

modules/field/tests/field_test.module, line 252

Code

function field_test_field_widget_form_alter(&$element, &$form_state, $context) {
    switch ($context['field']['field_name']) {
        case 'alter_test_text':
            drupal_set_message('Field size: ' . $context['instance']['widget']['settings']['size']);
            break;
        case 'alter_test_options':
            drupal_set_message('Widget type: ' . $context['instance']['widget']['type']);
            break;
    }
}

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