function field_behaviors_widget

Determines the behavior of a widget with respect to an operation.

Parameters

string $op: The name of the operation. Currently supported: 'default_value', 'multiple_values'.

array $instance: The field instance array.

Return value

int One of these values:

Related topics

2 calls to field_behaviors_widget()
FieldInfo::prepareInstance in drupal/core/modules/field/lib/Drupal/field/FieldInfo.php
Prepares an instance definition for the current run-time context.
FieldInstanceEditForm::buildForm in drupal/core/modules/field_ui/lib/Drupal/field_ui/Form/FieldInstanceEditForm.php
Form constructor.

File

drupal/core/modules/field/field.info.inc, line 146
Field Info API, providing information about available fields and field types.

Code

function field_behaviors_widget($op, $instance) {
  $info = array();
  if ($component = entity_get_form_display($instance['entity_type'], $instance['bundle'], 'default')
    ->getComponent($instance['field_name'])) {
    $info = field_info_widget_types($component['type']);
  }
  return isset($info[$op]) ? $info[$op] : FIELD_BEHAVIOR_DEFAULT;
}