Skip to main content
added 536 characters in body
Source Link
melicerte
  • 141
  • 1
  • 6

If someone comes here, use template_preprocess_field

In template.php :

function MYTHEME_preprocess_field(&$variables) {
  $element = $variables['element'];

  if ($element['#field_name'] == 'field_myfield') {
    //Load the related node, I let you do this step ...
    //$nid = ...

    $nodeB = node_load($nid);
    $variables['items'][0]['#items'][] = $nodeB->field_another_image_field[LANGUAGE_NONE][0];
    //If you have a pager
    $variables['items'][0]['#pager']['#items'][] = $nodeB->field_another_image_field[LANGUAGE_NONE][0];
  }
}

If someone comes here, use template_preprocess_field

If someone comes here, use template_preprocess_field

In template.php :

function MYTHEME_preprocess_field(&$variables) {
  $element = $variables['element'];

  if ($element['#field_name'] == 'field_myfield') {
    //Load the related node, I let you do this step ...
    //$nid = ...

    $nodeB = node_load($nid);
    $variables['items'][0]['#items'][] = $nodeB->field_another_image_field[LANGUAGE_NONE][0];
    //If you have a pager
    $variables['items'][0]['#pager']['#items'][] = $nodeB->field_another_image_field[LANGUAGE_NONE][0];
  }
}
Source Link
melicerte
  • 141
  • 1
  • 6

If someone comes here, use template_preprocess_field