You are here

function display_field_copy_field in Display Field Copy 8

Same name and namespace in other branches
  1. 2.x display_field_copy.module \display_field_copy_field()

Field Preprocess Callback.

Move the items into the proper place and set is_multiple to TRUE.

1 string reference to 'display_field_copy_field'
display_field_copy_theme_registry_alter in ./display_field_copy.module
Implements hook_theme_registry_alter().

File

./display_field_copy.module, line 27
Contains display_field_copy.module.

Code

function display_field_copy_field(array &$variables) {
  $element =& $variables['element'];
  $field_type = $element['#field_type'];
  if ($field_type != 'ds') {
    return;
  }
  $field_name = $element['#field_name'];
  if (!strpos($field_name, ':')) {
    return;
  }
  $pieces = explode(':', $field_name);
  if ($pieces[0] != 'display_field_copy') {
    return;
  }
  $items = $element[0][0];
  unset($element[0]);
  $element = array_merge($element, $items);
  if (count($items) > 1) {
    $element['#is_multiple'] = TRUE;
  }
}