function field_ui_default_value_widget
Builds the default value fieldset for a given field instance.
1 call to field_ui_default_value_widget()
- field_ui_field_edit_form in modules/
field_ui/ field_ui.admin.inc - Form constructor for the field instance settings form.
File
-
modules/
field_ui/ field_ui.admin.inc, line 1995
Code
function field_ui_default_value_widget($field, $instance, &$form, &$form_state) {
$field_name = $field['field_name'];
$element = array(
'#type' => 'fieldset',
'#title' => t('Default value'),
'#collapsible' => FALSE,
'#tree' => TRUE,
'#description' => t('The default value for this field, used when creating new content.'),
// Stick to an empty 'parents' on this form in order not to breaks widgets
// that do not use field_widget_[field|instance]() and still access
// $form_state['field'] directly.
'#parents' => array(),
);
// Insert the widget.
$items = $instance['default_value'];
$instance['required'] = FALSE;
$instance['description'] = '';
// @todo Allow multiple values (requires more work on 'add more' JS handler).
$element += field_default_form($instance['entity_type'], NULL, $field, $instance, LANGUAGE_NONE, $items, $element, $form_state, 0);
return $element;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.