Skip to content

Instantly share code, notes, and snippets.

@jdvc
Last active August 26, 2015 23:49
Show Gist options
  • Save jdvc/17221001189d824bf8df to your computer and use it in GitHub Desktop.
Save jdvc/17221001189d824bf8df to your computer and use it in GitHub Desktop.
<?php
if ($node->type == 'course' || $node->type == 'brand') {
$extrafield_name = 'vhp3_action_menu';
dpm($node);
dpm($node->field_brand);
if (isset($extra_fields[$extrafield_name]) && isset($extra_fields[$extrafield_name]['visible']) && $extra_fields[$extrafield_name]['visible']) {
$sony_node = node_load(2962);
// when i do this dpm, the sony vhp data is missing on the course page
// same node no vhp data via node_load
dpm($sony_node);
// samme node vhp data
dpm($node);
$node->content[$extrafield_name] = array(
'#title' => t('VHP 3 Action Menu'),
'#theme' => 'ccs_brands_vhp_action_menu',
'#view_mode' => $view_mode,
'#language' => $langcode,
'#field_name' => $extrafield_name,
'#entity_type' => 'node',
'#bundle' => $node->type,
'#object' => $node,
'#items' => $node->vhp['data']['action_menu_styling']['am_container']['item'],
'#label_display' => 'hidden',
);
}
// test if course and brand == sony
else if ($node->type == 'course' && $node->field_brand['und'][0]['tid'] == 2049) {
// load sony node to get action menu items
$sony_node = node_load(2962);
// when i do this dpm, the sony vhp data is missing on the course page
dpm($sony_node);
$node->content[$extrafield_name] = array(
'#title' => t('VHP 3 Action Menu'),
'#theme' => 'ccs_brands_vhp_action_menu',
'#view_mode' => $view_mode,
'#language' => $langcode,
'#field_name' => $extrafield_name,
'#entity_type' => 'node',
'#bundle' => $node->type,
'#object' => $node,
'#items' => $sony_node->vhp['data']['action_menu_styling']['am_container']['item'],
'#label_display' => 'hidden',
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment