本文整理汇总了PHP中drupal_is_front_page函数的典型用法代码示例。如果您正苦于以下问题:PHP drupal_is_front_page函数的具体用法?PHP drupal_is_front_page怎么用?PHP drupal_is_front_page使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了drupal_is_front_page函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: nuboot_radix_breadcrumb
/**
* Implements theme_breadcrumb().
*/
function nuboot_radix_breadcrumb($variables)
{
if (drupal_is_front_page()) {
return;
}
$breadcrumb = $variables['breadcrumb'];
$contexts = array();
if (!empty($breadcrumb)) {
$output = '<h2 class="element-invisible">' . t('You are here') . '</h2>';
$crumbs = '<ul class="breadcrumb">';
if (!drupal_is_front_page()) {
$crumbs .= '<li class="home-link"><a href="' . url('<front>') . '"><i class="fa fa fa-home"></i><span> Home</span></a></li>';
}
// Remove null values.
$breadcrumb = array_filter($breadcrumb);
$i = 1;
foreach ($breadcrumb as $value) {
if ($i == count($breadcrumb)) {
$crumbs .= '<li class="active-trail">' . $value . '</li>';
} else {
$crumbs .= '<li>' . $value . '</li>';
}
$i++;
}
$crumbs .= '</ul>';
return $crumbs;
}
}
示例2: uconn_theme_preprocess_page
/**
* Implements hook_preprocess_page().
*/
function uconn_theme_preprocess_page(&$variables)
{
$path = current_path();
$path_array = explode("/", $path);
// Add script to the front page, to control the height of the three columns at the bottom.
// Does not work natively in Zen grids, so this is required.
if (drupal_is_front_page()) {
$theme_path = drupal_get_path('theme', $GLOBALS['theme']);
drupal_add_js("{$theme_path}/js/jquery.matchHeight-min.js");
drupal_add_js("{$theme_path}/js/matchHeightBehaviour.js");
}
// Selectively add class to content, edge case requires particular
// Styling on the search result page. Set here so it is always
// Available.
$variables['inner_page_wrapper'] = "";
if (count($path_array) >= 2) {
if ($path_array[0] == 'islandora' && $path_array[1] == 'search') {
global $_islandora_solr_queryclass;
$sr = new IslandoraSolrResults();
$secondary_display_profiles = $sr->addSecondaries($_islandora_solr_queryclass);
$default_rss_icon_location = "/sites/all/modules/islandora_solr_search/islandora_solr_config/images/rss.png";
$new_rss_icon_location = "/" . drupal_get_path('theme', 'uconn_theme') . '/images/rss_w.png';
$secondary_display_profiles = str_replace($default_rss_icon_location, $new_rss_icon_location, $secondary_display_profiles);
if (isset($secondary_display_profiles)) {
$variables['secondary_display_profiles'] = $secondary_display_profiles;
}
$variables['inner_page_wrapper'] = "inner-page-wrapper";
}
}
}
示例3: songlap_preprocess_page
/**
* @file
* This file is empty by default because the base theme chain (Alpha & Omega) provides
* all the basic functionality. However, in case you wish to customize the output that Drupal
* generates through Alpha & Omega this file is a good place to do so.
*
* Alpha comes with a neat solution for keeping this file as clean as possible while the code
* for your subtheme grows. Please read the README.txt in the /preprocess and /process subfolders
* for more information on this topic.
*/
function songlap_preprocess_page(&$vars)
{
if (drupal_is_front_page()) {
$breadcrumb = array();
$breadcrumb[] = t('Home');
drupal_set_breadcrumb($breadcrumb);
}
if (arg(0) == 'taxonomy' && arg(1) == 'term' && is_null(arg(3))) {
$term = taxonomy_term_load(arg(2));
$breadcrumb = '';
$breadcrumb .= '<div class="breadcrumb">';
$breadcrumb .= '<a href="' . $vars['front_page'] . '">' . t('Home') . '</a> ';
$breadcrumb .= '» ' . $term->name;
$breadcrumb .= '</div>';
$vars['breadcrumb'] = $breadcrumb;
}
if ($_GET['q'] == 'projects') {
$breadcrumb = '';
$breadcrumb .= '<div class="breadcrumb">';
$breadcrumb .= '<a href="' . $vars['front_page'] . '">' . t('Home') . '</a> ';
$breadcrumb .= '» ' . t('Projects');
$breadcrumb .= '</div>';
$vars['breadcrumb'] = $breadcrumb;
}
}
示例4: dkan_breadcrumb
/**
* Implements theme_breadcrumb().
*/
function dkan_breadcrumb($variables)
{
if (drupal_is_front_page()) {
return;
}
$breadcrumb = $variables['breadcrumb'];
$contexts = array();
if (!empty($breadcrumb)) {
foreach ($breadcrumb as $num => $item) {
if ($item == '<a href="/">Home</a>') {
$breadcrumb[$num] = '<a href="/"><i class="icon-large icon-home"></i><span> Home</span></a>';
}
}
$output = '<h2 class="element-invisible">' . t('You are here') . '</h2>';
$crumbs = '<ul class="breadcrumb">';
// Remove null values.
$breadcrumb = array_filter($breadcrumb);
$i = 1;
foreach ($breadcrumb as $value) {
if ($i == count($breadcrumb)) {
$crumbs .= '<li class="active-trail">' . $value . '</li>';
} else {
$crumbs .= '<li>' . $value . '</li>';
}
$i++;
}
$crumbs .= '</ul>';
return $crumbs;
}
}
示例5: elements_theme_links__system_main_menu
function elements_theme_links__system_main_menu($variables)
{
$links = $variables['links'];
$attributes = $variables['attributes'];
$heading = $variables['heading'];
global $language_url;
$output = '';
if (count($links) > 0) {
$output = '';
// Treat the heading first if it is present to prepend it to the
// list of links.
if (!empty($heading)) {
if (is_string($heading)) {
// Prepare the array that will be used when the passed heading
// is a string.
$heading = array('text' => $heading, 'level' => 'h2');
}
$output .= '<' . $heading['level'];
if (!empty($heading['class'])) {
$output .= drupal_attributes(array('class' => $heading['class']));
}
$output .= '>' . check_plain($heading['text']) . '</' . $heading['level'] . '>';
}
$output .= '<div id="pages">';
$num_links = count($links);
$i = 1;
foreach ($links as $key => $link) {
$class = array($key);
// Add first, last and active classes to the list of links to help out themers.
if ($i == 1) {
$class[] = 'first';
}
if ($i == $num_links) {
$class[] = 'last';
}
if (isset($link['href']) && ($link['href'] == $_GET['q'] || $link['href'] == '<front>' && drupal_is_front_page()) && (empty($link['language']) || $link['language']->language == $language_url->language)) {
$class[] = 'active';
}
$output .= '<span class="menu-items"><h3>';
if (isset($link['href'])) {
// Pass in $link as $options, they share the same keys.
$output .= l($link['title'], $link['href'], $link);
} elseif (!empty($link['title'])) {
// Some links are actually not links, but we wrap these in <span> for adding title and class attributes.
if (empty($link['html'])) {
$link['title'] = check_plain($link['title']);
}
$span_attributes = '';
if (isset($link['attributes'])) {
$span_attributes = drupal_attributes($link['attributes']);
}
$output .= '<h3' . $span_attributes . '>' . $link['title'] . '</h3><span>' . $link['attributes']['title'] . '</span';
}
$i++;
$output .= "</h3>" . $link['attributes']['title'] . "</span>\n";
}
$output .= '</div>';
}
return $output;
}
示例6: bootstrap_menu_link
/**
* Overrides theme_menu_link().
*/
function bootstrap_menu_link(array $variables)
{
$element = $variables['element'];
$sub_menu = '';
if ($element['#below']) {
// Prevent dropdown functions from being added to management menu so it
// does not affect the navbar module.
if ($element['#original_link']['menu_name'] == 'management' && module_exists('navbar')) {
$sub_menu = drupal_render($element['#below']);
} elseif (!empty($element['#original_link']['depth']) && $element['#original_link']['depth'] >= 1) {
// Add our own wrapper.
unset($element['#below']['#theme_wrappers']);
$sub_menu = '<ul class="dropdown-menu">' . drupal_render($element['#below']) . '</ul>';
// Generate as standard dropdown.
//$element['#title'] .= ' <span class="caret"></span>';
$element['#attributes']['class'][] = 'dropdown';
$element['#localized_options']['html'] = TRUE;
// Set dropdown trigger element to # to prevent inadvertant page loading
// when a submenu link is clicked.
//$element['#localized_options']['attributes']['data-target'] = '#';
$element['#localized_options']['attributes']['class'][] = 'dropdown-toggle';
//$element['#localized_options']['attributes']['data-toggle'] = 'dropdown';
}
}
// On primary navigation menu, class 'active' is not set on active menu item.
// @see https://drupal.org/node/1896674
if (($element['#href'] == $_GET['q'] || $element['#href'] == '<front>' && drupal_is_front_page()) && empty($element['#localized_options']['language'])) {
$element['#attributes']['class'][] = 'active';
}
$output = l($element['#title'], $element['#href'], $element['#localized_options']);
return '<li' . drupal_attributes($element['#attributes']) . '>' . $output . $sub_menu . "</li>\n";
}
示例7: _myu_language_dropdown
function _myu_language_dropdown($type = 'language')
{
if (drupal_multilingual()) {
global $language_url;
$path = drupal_is_front_page() ? '<front>' : $_GET['q'];
//$type = 'language_url';
$languages = language_negotiation_get_switch_links($type, $path);
$items = array();
foreach ($languages->links as $lang_code => $lang_options) {
if ($lang_options['language']->language === $language_url->language) {
// Icon for the selected language
if (module_exists('languageicons')) {
$icon = theme('languageicons_icon', array('language' => (object) array('language' => $lang_code), 'title' => $language_url->native));
}
$active_language_text = $icon . '<span class="langname">' . strtoupper($language_url->language) . '</span><i class="fa fa-angle-down"></i>';
$active_language_link = l($active_language_text, 'javascript:;', array('html' => TRUE, 'external' => TRUE, 'attributes' => array('class' => 'dropdown-toggle', 'data-close-others' => 'true', 'data-hover' => 'dropdown', 'data-toggle' => 'dropdown')));
} else {
if (!isset($lang_options['query'])) {
$lang_options['query'] = drupal_get_query_parameters();
}
$items[] = l($lang_options['title'], $lang_options['href'], $lang_options);
}
}
$language_flag_list = theme('item_list', array('items' => $items, 'type' => 'ul', 'attributes' => array('class' => 'dropdown-menu dropdown-menu-default')));
return '<ul class="menu nav navbar-nav language"><li class="dropdown dropdown-language">' . $active_language_link . $language_flag_list . '</li></ul>';
}
}
示例8: boot_press_menu_link
/**
* Returns HTML for menu link.
*/
function boot_press_menu_link(array $variables)
{
$element = $variables['element'];
$sub_menu = '';
if ($element['#below']) {
if ($element['#original_link']['menu_name'] == 'management' && module_exists('navbar')) {
$sub_menu = drupal_render($element['#below']);
} else {
unset($element['#below']['#theme_wrappers']);
$sub_menu = '<ul class="dropdown-menu">' . drupal_render($element['#below']) . '</ul>';
$element['#localized_options']['attributes']['class'][] = 'dropdown-toggle';
$element['#localized_options']['attributes']['data-toggle'] = 'dropdown';
if (!empty($element['#original_link']['depth']) && $element['#original_link']['depth'] > 1) {
$element['#attributes']['class'][] = 'dropdown-submenu';
} else {
$element['#attributes']['class'][] = 'dropdown';
$element['#localized_options']['html'] = TRUE;
$element['#title'] .= ' <span class="caret"></span>';
}
$element['#localized_options']['attributes']['data-target'] = '#';
}
}
if (($element['#href'] == $_GET['q'] || $element['#href'] == '<front>' && drupal_is_front_page()) && (empty($element['#localized_options']['language']) || $element['#localized_options']['language']->language == $language_url->language)) {
$element['#attributes']['class'][] = 'active';
}
$menu_output = l($element['#title'], $element['#href'], $element['#localized_options']);
return '<li' . drupal_attributes($element['#attributes']) . '>' . $menu_output . $sub_menu . "</li>\n";
}
示例9: phptemplate_menu_links
function phptemplate_menu_links($links, $attributes = array())
{
if (!count($links)) {
return '';
}
$level_tmp = explode('-', key($links));
$level = $level_tmp[0];
$output = "<ul class=\"links-{$level} " . $attributes['class'] . "\" id=\"" . $attributes['id'] . "\">\n";
$num_links = count($links);
$i = 1;
foreach ($links as $index => $link) {
$output .= '<li';
$output .= ' class="';
if (stristr($index, 'active')) {
$output .= 'active';
} elseif (drupal_is_front_page() && $link['href'] == '<front>') {
$link['attributes']['class'] = 'active';
$output .= 'active';
}
if ($i == 1) {
$output .= ' first';
}
if ($i == $num_links) {
$output .= ' last';
}
$output .= '"';
$output .= ">" . l($link['title'], $link['href'], $link['attributes'], $link['query'], $link['fragment']) . "</li>\n";
$i++;
}
$output .= '</ul>';
return $output;
}
示例10: constellation_preprocess_html
/**
* Override or insert variables into the html templates.
*/
function constellation_preprocess_html(&$vars)
{
if (drupal_is_front_page()) {
$vars['head_title'] = 'Freelance Drupal web development | NEAR DARK Design Studio';
}
// Load the media queries styles
// Remember to rename these files to match the names used here - they are
// in the CSS directory of your subtheme.
$media_queries_css = array('constellation.responsive.style.css', 'constellation.responsive.gpanels.css');
load_subtheme_media_queries($media_queries_css, 'constellation');
drupal_add_css(drupal_get_path('theme', 'constellation') . '/css/ie-8.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'lte IE 8', '!IE' => FALSE), 'preprocess' => FALSE));
//dpm($vars);
/**
* Load IE specific stylesheets
* AT automates adding IE stylesheets, simply add to the array using
* the conditional comment as the key and the stylesheet name as the value.
*
* See our online help: http://adaptivethemes.com/documentation/working-with-internet-explorer
*
* For example to add a stylesheet for IE8 only use:
*
* 'IE 8' => 'ie-8.css',
*
* Your IE CSS file must be in the /css/ directory in your subtheme.
*/
/* -- Delete this line to add a conditional stylesheet for IE 7 or less.
$ie_files = array(
'lte IE 7' => 'ie-lte-7.css',
);
load_subtheme_ie_styles($ie_files, 'constellation');
// */
}
示例11: bootstrap_menu_link__book_toc
/**
* Overrides theme_menu_link() for book module.
*/
function bootstrap_menu_link__book_toc(array $variables)
{
$element = $variables['element'];
$sub_menu = drupal_render($element['#below']);
$title = $element['#title'];
$href = $element['#href'];
$options = !empty($element['#localized_options']) ? $element['#localized_options'] : array();
$attributes = !empty($element['#attributes']) ? $element['#attributes'] : array();
$attributes['role'] = 'presentation';
// Header.
$link = TRUE;
if ($title && $href === FALSE) {
$attributes['class'][] = 'dropdown-header';
$link = FALSE;
} elseif ($title === FALSE && $href === FALSE) {
$attributes['class'][] = 'divider';
$link = FALSE;
} elseif (($href == $_GET['q'] || $href == '<front>' && drupal_is_front_page()) && empty($options['language'])) {
$attributes['class'][] = 'active';
}
// Filter the title if the "html" is set, otherwise l() will automatically
// sanitize using check_plain(), so no need to call that here.
if (!empty($options['html'])) {
$title = _bootstrap_filter_xss($title);
}
// Convert to a link.
if ($link) {
$title = l($title, $href, $options);
}
return '<li' . drupal_attributes($attributes) . '>' . $title . $sub_menu . "</li>\n";
}
示例12: cstark_preprocess_node
function cstark_preprocess_node(&$variables)
{
if (user_access('administer nodes')) {
$variables['edit_link'] = l(t('Edit'), 'node/' . $variables['nid'] . '/edit');
if ($variables['type'] == 'painting') {
$title = $variables['promote'] ? t('Remove from front page') : t('Add to front page');
$variables['set_as_main_link'] = l($title, 'set-as-main/' . $variables['nid']);
// Facebook share.
$url = url('node/' . $variables['nid'], array('absolute' => TRUE));
$variables['share_link'] = l(t('Share'), "http://www.facebook.com/sharer.php?u={$url}", array('attributes' => array('class' => array('facebook'))));
}
}
if ($variables['type'] == 'painting') {
$wrapper = entity_metadata_wrapper('node', $variables['nid']);
if ($image = $wrapper->field_image->value()) {
$element = array('#tag' => 'meta', '#attributes' => array('property' => 'og:image', 'content' => file_create_url($image['uri'])));
drupal_add_html_head($element, 'cstark_painting_image');
$element = array('#tag' => 'meta', '#attributes' => array('property' => 'og:title', 'content' => $wrapper->label()));
drupal_add_html_head($element, 'cstark_painting_title');
}
}
if ($variables['type'] == 'painting' && !drupal_is_front_page()) {
$variables['pager'] = shapira_get_painting_pager($variables['nid']);
}
if ($variables['type'] != 'news') {
$variables['hide_title'] = true;
}
if ($variables['type'] == 'painting') {
if ($variables['field_image']) {
$info = image_get_info(image_style_path('painting', $variables['field_image'][0]['uri']));
$variables['node_width'] = $info['width'];
}
}
}
示例13: iha_preprocess_page
function iha_preprocess_page(&$variables)
{
$search_box = drupal_render(drupal_get_form('search_form'));
$variables['search_box'] = $search_box;
if (drupal_is_front_page()) {
unset($variables['page']['content']['system_main']['default_message']);
//will remove message "no front page content is created"
drupal_set_title('');
//removes welcome message (page title)
}
if (arg(0) == 'node') {
$variables['node_content'] =& $variables['page']['content']['system_main']['nodes'][arg(1)];
}
if (isset($variables['node']->type)) {
$variables['theme_hook_suggestions'][] = 'page__' . $variables['node']->type;
}
// Prepare the mobile menu.
$user_menu = menu_tree('user-menu');
$main_menu = menu_tree('main-menu');
$menu_tree = array_merge($main_menu, $user_menu);
// FYI for future dev's - If need to add more menu items, then load the other menu through menu tree as well and do a
// array merge or for loop to attach the items to the $menu_tree.
$mobile_menu = '<ul class="list-unstyled main-menu">';
foreach ($menu_tree as $mlid => $mm) {
if (is_int($mlid)) {
$mobile_menu .= iha_render_mobile_menu($mm);
}
}
$mobile_menu .= '</ul>';
$variables['mobile_menu'] = $mobile_menu;
}
示例14: hc_bootstrap_preprocess_page
function hc_bootstrap_preprocess_page(&$variables)
{
//Set default section to display
if (drupal_is_front_page()) {
menu_set_active_item('food-and-groceries');
}
/**
* Add page template suggestions based on the aliased path. For instance, if the current
* page has an alias of about/history/early, we'll have templates of:
* page-about-history-early.tpl.php, page-about-history.tpl.php, page-about.tpl.php
* Whichever is found first is the one that will be used.
*/
if (module_exists('path')) {
$alias = drupal_get_path_alias(str_replace('/edit', '', $_GET['q']));
if ($alias != $_GET['q']) {
$template_filename = 'page';
foreach (explode('/', $alias) as $path_part) {
$template_filename = $template_filename . '-' . $path_part;
$vars['template_files'][] = $template_filename;
}
}
}
//Add shopping cart to available output
$variables['side_cart'] = block_render('views', 'sidebar_cart-cart');
}
示例15: jake_preprocess_page
/**
* Preprocessor for theme('page').
*/
function jake_preprocess_page(&$vars)
{
// Help link
if (!empty($vars['help'])) {
$vars['help_link'] = l('?', $_GET['q'], array('fragment' => 'help', 'attributes' => array('class' => 'help-link')));
}
// Admin link
if (user_access('administer mn')) {
$vars['admin_link'] = l(t('Admin'), 'admin/settings/site-information', array('attributes' => array('class' => 'admin-link')));
}
// Add body class for layout.
$vars['attr']['class'] .= !empty($vars['template_files']) ? ' ' . end($vars['template_files']) : '';
// Site name
$vars['site_name'] = theme('site_name');
// Display mission in a block
if (!empty($vars['mission']) && drupal_is_front_page()) {
$mission_block = new stdClass();
$mission_block->content = $vars['mission'];
$vars['mission_block'] = theme('block', $mission_block);
}
// Truncate the slogan so it doesn't break the header
$vars['site_slogan'] = truncate_utf8($vars['site_slogan'], 35);
// Determine stack height for fullscreen views.
$class = array();
if ($stackclass = context_get('theme', 'stackclass')) {
$class[] = $stackclass;
}
if (!empty($vars['tabs'])) {
$class[] = 'tabs';
}
if (!empty($class)) {
$vars['attr']['class'] .= ' with-' . implode('-', $class);
}
}