/** * @todo finish function */ public function getNodeQueue($id) { $n = 20; return \nodequeue_load_nodes($id, FALSE, 0, $n); }
function simpl_preprocess_page(&$vars) { if ($vars['is_front']) { // load homepage promoted menu $vars['menus']['promoted'] = render_menu('menu-promoted'); // load populare content $vars['popular'] = get_v('popular'); // pprint($vars['popular']); $vars['nq'] = array(); // load hero nodequeue $nq_hero = nodequeue_load_nodes(1, false, 0, 1); foreach ($nq_hero as $node) { $hero[] = n_load($node->nid); } $vars['nq']['hero'] = $hero; // load promoted nodequeue $nq_featured = nodequeue_load_nodes(2, false, 0, 3); foreach ($nq_featured as $node) { $featured[] = n_load($node->nid); } $vars['nq']['featured'] = $featured; // load latest nodequeue $nq_latest = nodequeue_load_nodes(4, false, 0, 12); foreach ($nq_latest as $node) { $latest[] = n_load($node->nid); } $vars['nq']['latest'] = $latest; // load opinions nodequeue $nq_opinions = nodequeue_load_nodes(5, false, 0, 6); foreach ($nq_opinions as $node) { $opinions[] = $node->nid; } $vars['nq']['opinions'] = array_values(node_load_multiple($opinions)); //$vars['opinions'] = array_values(get_vn('taxonomy_term', array('all', 1,'blog'), 5)); } /* Node page */ if (!empty($vars['node'])) { $GLOBALS['body-class'] = 'node-page'; $vars['n'] = node_load($vars['node']->nid); $section_id = $vars['n']->field_section['und'][0]['tid']; $tags = $vars['n']->field_tags['und']; if (count($tags)) { $tags_ids = []; foreach ($tags as $tag) { $tags_ids[] = $tag['tid']; } } $vars['more'] = array_values(get_vn('taxonomy_term', array(join('+', $tags_ids), 1, 'article', $vars['node']->nid), 3)); $vars['readlist'] = array_values(get_vn('taxonomy_term', array($section_id, 1, 'article+blog+gallery'), 5)); $vars['related'] = array_values(get_vn('taxonomy_term', array($section_id, 1, $vars['n']->type), 5)); $vars['tags'] = get_tags($vars['n']); $vars['popular'] = get_v('popular'); if ($vars['node']->type == 'article') { //create dedicated page for node, f**k the drupal nesting shit $vars['theme_hook_suggestions'][] = '__article'; $vars['r'] = node_view($vars['n'])['body'][0]['#markup']; $vars['author'] = get_author($vars['n']); } else { if ($vars['node']->type == 'blog') { $vars['theme_hook_suggestions'][] = '__blog'; $author = get_author($vars['n']); $vars['blog']['author'] = $author; //pprint($author); $element1 = array('#tag' => 'meta', '#attributes' => array('property' => 'og:image', 'content' => render_image('x585', $author->image_src))); $element2 = array('#tag' => 'link', '#attributes' => array('rel' => 'image_src', 'type' => 'image/jpeg', 'href' => render_image('x585', $author->image_src))); drupal_add_html_head($element1, 'element1'); drupal_add_html_head($element2, 'element2'); // load opinions nodequeue $nq_opinions = nodequeue_load_nodes(5, false, 0, 6); foreach ($nq_opinions as $node) { $opinions[] = $node->nid; } $vars['nq']['opinions'] = array_values(node_load_multiple($opinions)); $vars['readlist'] = array_values(get_vn('opinions_author', array($vars['blog']['author']->nid, $vars['node']->nid), 5)); } else { if ($vars['node']->type == 'author') { $vars['theme_hook_suggestions'][] = '__author'; $vars['author'] = get_author($vars['n']); $element1 = array('#tag' => 'meta', '#attributes' => array('property' => 'og:image', 'content' => render_image('x585', $vars['author']->image_src))); $element2 = array('#tag' => 'link', '#attributes' => array('rel' => 'image_src', 'type' => 'image/jpeg', 'href' => render_image('x585', $vars['author']->image_src))); drupal_add_html_head($element1, 'element1'); drupal_add_html_head($element2, 'element2'); // load opinions nodequeue $nq_opinions = nodequeue_load_nodes(5, false, 0, 6); foreach ($nq_opinions as $node) { $opinions[] = $node->nid; } $vars['nq']['opinions'] = array_values(node_load_multiple($opinions)); $vars['opinions_author'] = array_values(get_vn('opinions_author', array($vars['n']->nid, 0), 10)); //pprint($vars['opinions_author']); } else { if ($vars['node']->type == 'social') { $vars['author'] = get_author($vars['n']); $vars['theme_hook_suggestions'][] = '__social'; } else { if ($vars['node']->type == 'page') { $vars['theme_hook_suggestions'][] = '__static'; } } } } } } /* --- Node page ----- */ /* Taxonomy Term pages */ if (arg(0) == 'taxonomy' && arg(1) == 'term' && arg(4) == 'blog') { // load opinions nodequeue $nq_opinions = nodequeue_load_nodes(5, false, 0, 6); foreach ($nq_opinions as $node) { $opinions[] = $node->nid; } $vars['nq']['opinions'] = array_values(node_load_multiple($opinions)); $vars['theme_hook_suggestions'][] = '__opinions'; } /* --- Taxonomy Term pages ----- */ }
?> " class="<?php print $classes; ?> clearfix"<?php print $attributes; ?> > <?php $term = $node->field_category['und'][0]['taxonomy_term']; $term_name = $node->field_category['und'][0]['taxonomy_term']->name; $category_tid = $term->tid; $nodequeue_nodes = nodequeue_load_nodes(2, FALSE, 0, 0); $subcategory_nodes = array(); foreach ($nodequeue_nodes as $nodequeue_node) { if ($nodequeue_node->field_category['und'][0]['tid'] == $category_tid) { $subcategory_nodes[] = $nodequeue_node; if ($nodequeue_node->nid == $node->nid) { $index = count($subcategory_nodes) - 1; } } } $url_parts = explode('/', request_uri()); if (!function_exists('removeUrlSpace')) { function removeUrlSpace($string) { //Lower case everything $string = strtolower($string);
/** * Get nodeque by id */ public function getNodeQueue($id, $backward = FALSE, $from = 0, $count = 20) { return \nodequeue_load_nodes($id, $backward, $from, $count); }