public function FieldInfo::prepareInstanceWidget
public FieldInfo::prepareInstanceWidget($widget, $field_type)
Prepares widget properties for the current run-time context.
Parameters
$widget: Widget specifications as found in $instance['widget'].
$field_type: The field type.
Return value
The widget properties completed for the current runtime context.
File
- modules/field/field.info.class.inc, line 575
Class
- FieldInfo
- Provides field and instance definitions for the current runtime environment.
Code
public function prepareInstanceWidget($widget, $field_type) { $field_type_info = field_info_field_types($field_type); // Fill in default values. $widget += array( 'type' => $field_type_info['default_widget'], 'settings' => array(), 'weight' => 0, ); $widget_type_info = field_info_widget_types($widget['type']); // Fall back to default formatter if formatter type is not available. if (!$widget_type_info) { $widget['type'] = $field_type_info['default_widget']; $widget_type_info = field_info_widget_types($widget['type']); } $widget['module'] = $widget_type_info['module']; // Fill in default settings for the widget. $widget['settings'] += field_info_widget_settings($widget['type']); return $widget; }
© 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!field.info.class.inc/function/FieldInfo::prepareInstanceWidget/7.x