function button_field_form_field_ui_field_instance_edit_form_alter in Button Field 8
Implements hook_form_FORM_ID_alter().
Hides the required setting and default value from the field instance settings form because they do not apply to this field type.
File
- ./
button_field.module, line 87 - Defines a field, widget and formatter for the button field type.
Code
function button_field_form_field_ui_field_instance_edit_form_alter(&$form, &$form_state, $form_id) {
if ($form['#field']
->getType() == 'button_field') {
// Hide the required field and set it to false.
$form['instance']['required']['#access'] = FALSE;
$form['instance']['required']['#default_value'] = FALSE;
// No need to display a default value widget.
$form['instance']['default_value']['#access'] = FALSE;
}
}