You are here

function synonyms_select_default_value in Synonyms 7

Extract default value for a select widget of Synonyms module.

Parameters

array $field: Field definition array whose default value should be extracted

array $instance: Field instance definition array whose default value should be extracted

array $items: Array of items that should compose default value

Return value

array Array of default value that can be plugged in into a select widget

2 calls to synonyms_select_default_value()
synonyms_commerce_field_widget_form in synonyms_commerce/synonyms_commerce.module
Implements hook_field_widget_form().
synonyms_field_widget_form in ./synonyms.module
Implements hook_field_widget_form().

File

./synonyms.module, line 1579
Provide synonyms feature for Drupal entities.

Code

function synonyms_select_default_value($field, $instance, $items) {
  $default_value = array();
  $column = array_keys($field['columns']);
  $column = reset($column);
  foreach ($items as $item) {
    $default_value[] = $item[$column];
  }
  return $default_value;
}