_field_info_prepare_instance_widget

  1. drupal
    1. 8
    2. 7
Versions
8 – 7 _field_info_prepare_instance_widget($field, $widget)

Prepares widget specifications for the current run-time context.

Parameters

$field The field structure for the instance.

$widget Widget specifications as found in $instance['widget'].

Related topics

Code

modules/field/field.info.inc, line 377

<?php
function _field_info_prepare_instance_widget($field, $widget) {
  $field_type = field_info_field_types($field['type']);

  // Fill in default values.
  $widget += array(
    'type' => $field_type['default_widget'], 
    'settings' => array(), 
    'weight' => 0,
  );

  $widget_type = field_info_widget_types($widget['type']);
  // Fallback to default formatter if formatter type is not available.
  if (!$widget_type) {
    $widget['type'] = $field_type['default_widget'];
    $widget_type = field_info_widget_types($widget['type']);
  }
  $widget['module'] = $widget_type['module'];
  // Fill in default settings for the widget.
  $widget['settings'] += field_info_widget_settings($widget['type']);

  return $widget;
}
?>