function field_ui_default_value_widget
field_ui_default_value_widget($field, $instance, &$form, &$form_state)
Builds the default value fieldset for a given field instance.
File
- modules/field_ui/field_ui.admin.inc, line 1982
- Administrative interface for custom field type creation.
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; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!field_ui!field_ui.admin.inc/function/field_ui_default_value_widget/7.x