type == 'og') { $query->innerJoin('og_membership', 'ogm', 'n.nid = ogm.etid'); $query->condition('ogm.entity_type', 'node'); $query->condition('ogm.group_type', 'node'); $query->condition('ogm.gid', $space->id); } $item = menu_get_item(); // Checking for search_node alter tag. if (!isset($query->alterTags)) { // Check if we have a search_node alter tag. if (!isset($query->alterTags['search_node'])) { // Check the sort order for biblio. // If we're sorting by year, we want to sort by date as well to replicate D6 // sorting. if (variable_get('biblio_sort', 'year') == 'year') { // Get their sort order. $biblio_year_sort = $space->controllers->variable->get('biblio_order', 'space'); $order = &$query->getOrderBy(); // Don't wipe the non-default sort order, this will let users still toggle asc/desc sorting by year. if (array_key_exists('biblio_year', $order) && $order['biblio_year'] != $biblio_year_sort) { $biblio_year_sort = $order['biblio_year']; } // Rebuild the array to our defaults only when the user is NOT searching. When the user is searching, use their selections. if (isset($_GET['s']) && in_array($_GET['s'], array('author', 'title', 'type'))) { $s = current(array_keys($order)); $o = current($order); if ($s = 'biblio_sort_title') { $biblio_sort_title = $o; } } else { $order = array(); } // Sort by year, and after that create another sorting by the node's // "sticky" property, the creation date of the node, the Biblio date, and // the Biblio title. $order['biblio_year'] = isset($biblio_year_sort) ? $biblio_year_sort : 'DESC'; $order['n.sticky'] = 'DESC'; $order['n.created'] = 'DESC'; $order['biblio_sort_title'] = (isset($biblio_sort_title)) ? $biblio_sort_title : 'ASC'; } elseif (variable_get('biblio_sort', 'year') == 'type') { // Sort by type, and after that create another sorting by creation date of // the node. $order = &$query->getOrderBy(); $new_order = array(); foreach ($order as $key => $value) { $new_order[$key] = $value; if ($key == 'biblio_type_name') { $new_order['n.sticky'] = 'DESC'; $new_order['biblio_year'] = 'DESC'; $new_order['n.created'] = 'DESC'; } } $order = $new_order; } } } } /** * Implements hook_field_widget_form_alter(). * * Adding process to image types to change title to caption for homepage banners. */ function uw_virtual_site_homepage_field_widget_form_alter(&$element, &$form_state, $context) { if ($context['field']['type'] == 'image') { foreach (element_children($element) as $key => $child) { if ($element[$key]['#description'] == 'Provide banner images for virtual site homepages on Scholar at Waterloo sites.') { $element[$key]['#process'][] = 'uw_virtual_site_homepage_image_field_widget_process'; } } } } /** * Implements hook_image_field_widget_process(). * * Processing images to change title to caption for homepage banners. */ function uw_virtual_site_homepage_image_field_widget_process($element, &$form_state, $form) { // Set the title to be the caption and the description. $element['title']['#description'] = 'The title is display with the picture.'; // Return the altered element. return $element; } /** * Implements hook_page_alter(). * * Placing homepage banners on the virtual site homepage. */ function uw_virtual_site_homepage_page_alter(&$page) { global $base_path; // Setting the variables to be used in homepage banners. $index = 0; $continue = TRUE; if (isset($page['uw-virtual-site-homepage']['field_uw_faculty_list_logo'][0]['#markup'])) { $site_links = _uw_virtual_site_homepage_get_site_links(); if (isset($site_links[$page['uw-virtual-site-homepage']['field_uw_faculty_list_logo'][0]['#markup']])) { $site_link = $site_links[$page['uw-virtual-site-homepage']['field_uw_faculty_list_logo'][0]['#markup']]; $page['uw-virtual-site-homepage']['uw_scholar_row']['site_link'] = $site_link; } } // If there are banners, process them. if (isset($page['uw-virtual-site-homepage']['field_uw_homepage_banners'][$index])) { // HTML divs in homepage banners. $html = '
'; } else { // Close the opening HTML divs in homepage banners. if single image in banner. $html .= ''; $html .= ''; } // Set the html to the page variable. $page['uw_virtual_page_homepage_banners_html'] = $html; } // If there is credentials in the virutal site homepage settings, add it to the header. if (isset($page['uw-virtual-site-homepage']['field_uw_credentials'])) { if (isset($page['header_second']['boxes_site_info']['content']['#markup'])) { $page['header_second']['boxes_site_info']['content']['#markup'] = preg_replace('/