function field_test_field_widget_properties_alter

Implements hook_field_widget_properties_alter().

File

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

Code

function field_test_field_widget_properties_alter(&$widget, $context) {
    // Make the alter_test_text field 42 characters for nodes and comments.
    if (in_array($context['entity_type'], array(
        'node',
        'comment',
    )) && $context['field']['field_name'] == 'alter_test_text') {
        $widget['settings']['size'] = 42;
    }
}

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