Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kidsil/445856 to your computer and use it in GitHub Desktop.
Save kidsil/445856 to your computer and use it in GitHub Desktop.
$thisNode = $element['#node'];
//Finding the Key the Product1 is in
$product1Key = 0;
foreach ($header as $key=>$item) {
if (preg_match('/.*Product1.*/',$item)) {
$product1Key = $key;
}
}
$j=1;
for ($i=$product1Key;$i<=$product1Key+4;$i++) {
$fieldProduct = 'field_product'.$j;
$theProduct = $thisNode->$fieldProduct;
$productId = $theProduct[0]['nid'];
$productName = $theProduct[0]['safe']['title'];
$header[$i] = '<a href="'.base_path().'node/'.$productId.'">'.$productName.'</a>';
$j++;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment