Last updated July 30, 2012. Created by archnode on January 23, 2012.
Edited by kalman.hosszu. Log in to edit this page.
For the purpose of displaying the links from the field collection view field formatter at the top instead of the bottom here a little example:
<?php
function template_preprocess_field(&$variables) {
if ($variables['element']['#field_type'] == 'field_collection') {
//Iterate through all field items
foreach ($variables['items'] as $key => $item) {
$links = $item['links'];
unset($item['links']);
//Prepend links to render array
$variables['items'][$key] = array_merge(array('links' => $links), $item);
}
}
}
?>To use this in your theme just put the code in your template.php and exchange "template" in the function name with your theme name. Note that there are also preprocessing functions for modules available.