uid) { $title = t('Please login to continue'); } $vars['title'] = $title; if (!drupal_is_front_page()) { $vars['head_title'] = $title .' | '. $vars['site_name']; if ($vars['site_slogan'] != '') { $vars['head_title'] .= ' – '. $vars['site_slogan']; } } } // determine layout // 3 columns if ($vars['layout'] == 'both') { $vars['left_classes'] = 'col-left span-6'; $vars['right_classes'] = 'col-right span-6 last'; $vars['center_classes'] = 'col-center span-12'; $vars['body_classes'] .= ' col-3 '; } // 2 columns else if ($vars['layout'] != 'none') { // left column & center if ($vars['layout'] == 'left') { $vars['left_classes'] = 'col-left span-6'; $vars['center_classes'] = 'col-center span-18 last'; } // right column & center else if ($vars['layout'] == 'right') { $vars['right_classes'] = 'col-right span-6 last'; $vars['center_classes'] = 'col-center span-18'; } $vars['body_classes'] .= ' col-2 '; } // 1 column else { $vars['center_classes'] = 'col-center span-24'; $vars['body_classes'] .= ' col-1 '; } $vars['meta'] = ''; // SEO optimization, add in the node's teaser, or if on the homepage, the mission statement // as a description of the page that appears in search engines if ($vars['is_front'] && $vars['mission'] != '') { $vars['meta'] .= ''."\n"; } else if (isset($vars['node']->teaser) && $vars['node']->teaser != '') { $vars['meta'] .= ''."\n"; } else if (isset($vars['node']->body) && $vars['node']->body != '') { $vars['meta'] .= ''."\n"; } // SEO optimization, if the node has tags, use these as keywords for the page if (isset($vars['node']->taxonomy)) { $keywords = array(); foreach ($vars['node']->taxonomy as $term) { $keywords[] = $term->name; } $vars['meta'] .= ''."\n"; } // SEO optimization, avoid duplicate titles in search indexes for pager pages if (isset($_GET['page']) || isset($_GET['sort'])) { $vars['meta'] .= ''. "\n"; } /* I like to embed the Google search in various places, uncomment to make use of this // setup search for custom placement $search = module_invoke('google_cse', 'block', 'view', '0'); $vars['search'] = $search['content']; */ /* to remove specific CSS files from modules use this trick // Remove stylesheets $css = $vars['css']; unset($css['all']['module']['sites/all/modules/contrib/plus1/plus1.css']); $vars['styles'] = drupal_get_css($css); */ } /** * Intercept node template variables * * @param $vars * A sequential array of variables passed to the theme function. */ function blueprint_preprocess_node(&$vars) { $node = $vars['node']; // for easy reference // for easy variable adding for different node types switch ($node->type) { case 'page': break; } } /** * Intercept comment template variables * * @param $vars * A sequential array of variables passed to the theme function. */ function blueprint_preprocess_comment(&$vars) { static $comment_count = 1; // keep track the # of comments rendered // Calculate the comment number for each comment with accounting for pages. $page = 0; $comments_previous = 0; if (isset($_GET['page'])) { $page = $_GET['page']; $comments_per_page = variable_get('comment_default_per_page_' . $vars['node']->type, 1); $comments_previous = $comments_per_page * $page; } $vars['comment_count'] = $comments_previous + $comment_count; // if the author of the node comments as well, highlight that comment $node = node_load($vars['comment']->nid); if ($vars['comment']->uid == $node->uid) { $vars['author_comment'] = TRUE; } // only show links for users that can administer links if (!user_access('administer comments')) { $vars['links'] = ''; } // If comment subjects are disabled, don't display them. if (variable_get('comment_subject_field_' . $vars['node']->type, 1) == 0) { $vars['title'] = ''; } // Add the pager variable to the title link if it needs it. $fragment = 'comment-' . $vars['comment']->cid; $query = ''; if (!empty($page)) { $query = 'page='. $page; } $vars['title'] = l($vars['comment']->subject, 'node/'. $vars['node']->nid, array('query' => $query, 'fragment' => $fragment)); $vars['comment_count_link'] = l('#'. $vars['comment_count'], 'node/'. $vars['node']->nid, array('query' => $query, 'fragment' => $fragment)); $comment_count++; } /** * Override or insert variables into the block templates. * * @param $vars * An array of variables to pass to the theme template. * @param $hook * The name of the template being rendered ("block" in this case.) */ function blueprint_preprocess_block(&$vars, $hook) { $block = $vars['block']; // Special classes for blocks. $classes = array('block'); $classes[] = 'block-' . $block->module; $classes[] = 'region-' . $vars['block_zebra']; $classes[] = $vars['zebra']; $classes[] = 'region-count-' . $vars['block_id']; $classes[] = 'count-' . $vars['id']; $vars['edit_links_array'] = array(); $vars['edit_links'] = ''; if (user_access('administer blocks')) { include_once './' . drupal_get_path('theme', 'blueprint') . '/template.block-editing.inc'; blueprint_preprocess_block_editing($vars, $hook); $classes[] = 'with-block-editing'; } // Render block classes. $vars['classes'] = implode(' ', $classes); } /** * Intercept box template variables * * @param $vars * A sequential array of variables passed to the theme function. */ function blueprint_preprocess_box(&$vars) { // rename to more common text if (strpos($vars['title'], 'Post new comment') === 0) { $vars['title'] = 'Add your comment'; } } /** * Override, remove "not verified", confusing * * Format a username. * * @param $object * The user object to format, usually returned from user_load(). * @return * A string containing an HTML link to the user's page if the passed object * suggests that this is a site user. Otherwise, only the username is returned. */ function blueprint_username($object) { if ($object->uid && $object->name) { // Shorten the name when it is too long or it will break many tables. if (drupal_strlen($object->name) > 20) { $name = drupal_substr($object->name, 0, 15) .'...'; } else { $name = $object->name; } if (user_access('access user profiles')) { $output = l($name, 'user/'. $object->uid, array('attributes' => array('title' => t('View user profile.')))); } else { $output = check_plain($name); } } else if ($object->name) { // Sometimes modules display content composed by people who are // not registered members of the site (e.g. mailing list or news // aggregator modules). This clause enables modules to display // the true author of the content. if (!empty($object->homepage)) { $output = l($object->name, $object->homepage, array('attributes' => array('rel' => 'nofollow'))); } else { $output = check_plain($object->name); } } else { $output = variable_get('anonymous', t('Anonymous')); } return $output; } /** * Override, make sure Drupal doesn't return empty
* * Return a themed help message. * * @return a string containing the helptext for the current page. */ function blueprint_help() { $help = menu_get_active_help(); // Drupal sometimes returns empty
so strip tags to check if empty if (strlen(strip_tags($help)) > 1) { return '