当前位置: 首页>>代码示例>>PHP>>正文


PHP menu_get_object函数代码示例

本文整理汇总了PHP中menu_get_object函数的典型用法代码示例。如果您正苦于以下问题:PHP menu_get_object函数的具体用法?PHP menu_get_object怎么用?PHP menu_get_object使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了menu_get_object函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: aap_theme_breadcrumb

/**
 * Override of theme_breadcrumb().
 */
function aap_theme_breadcrumb($variables)
{
    $breadcrumb = $variables['breadcrumb'];
    $page_node = menu_get_object();
    $output = '<h2 class="element-invisible">' . t('You are here') . '</h2>';
    $output .= '<div class="breadcrumb">' . implode(' <p>></p> ', $breadcrumb);
    if (!empty($breadcrumb)) {
        if (!empty($page_node)) {
            $target = current_path();
            $target_text = substr($page_node->title, 0, 50) . '...';
            $target_link = l($target_text, drupal_get_path_alias($target));
            $content = $page_node->type;
            $target_content = l($content, drupal_get_path_alias($content));
            //	$output .=  '<p>></p>' . $target_content;
            $output .= '<p>></p>' . $target_link;
        } else {
            $target = current_path();
            $path_alias = drupal_get_path_alias($target);
            $target_link = l(drupal_get_path_alias($target), drupal_get_path_alias($target));
            $output .= '<p>></p>' . $target_link;
        }
        // Provide a navigational heading to give context for breadcrumb links to
        // screen-reader users. Make the heading invisible with .element-invisible.
        $output .= '</div>';
        return $output;
    }
}
开发者ID:swarad07,项目名称:india-standalone-drupal,代码行数:30,代码来源:template.php

示例2: thearchivetheme_process_page

function thearchivetheme_process_page(&$vars)
{
    $usernav = '';
    if (user_is_logged_in()) {
        global $user;
        $node = menu_get_object();
        $ar = array();
        if ($node) {
            $nid = $node->nid;
            if (user_access('update collection')) {
                $ar[] = '<a href="collection/edit/' . $nid . '">編輯</a>';
            }
            if (user_access('update collection')) {
                $ar[] = '<a href="collection/update/file/' . $nid . '">更新數位檔</a>';
            }
            if (user_access('update collection') && editcol_is_video_collection($nid)) {
                $ar[] = '<a href="collection/upload/video_icons/' . $nid . '">自定影片圖示</a>';
            }
            if (user_access('delete collection')) {
                $ar[] = '<a href="collection/delete/' . $nid . '">刪除</a>';
            }
        }
        if (user_access('control panel')) {
            $ar[] = '<a href="/control_panel/1">Control Panel</a>';
        }
        $ar[] = 'Login as ' . $user->name;
        $ar[] = '<a href="/user/logout">Log out</a>';
        $usernav = '<div class="row">' . implode(' | ', $ar) . '</div>';
    }
    $vars['usernav'] = $usernav;
}
开发者ID:318io,项目名称:318-io,代码行数:31,代码来源:template.php

示例3: mooc_foundation_access_preprocess_page

/**
 * Implements template_preprocess_page.
 */
function mooc_foundation_access_preprocess_page(&$variables)
{
    // speedreader is enabled
    if (module_exists('speedreader')) {
        $variables['speedreader'] = TRUE;
    }
    // mespeak is enabled
    if (module_exists('mespeak')) {
        $variables['mespeak'] = TRUE;
    }
    // support for add child page shortcut
    $node = menu_get_object();
    if ($node && user_access('access printer-friendly version')) {
        $variables['tabs_extras'][200][] = '<hr>';
        $variables['tabs_extras'][200][] = l(t('Print'), 'book/export/html/' . arg(1));
    }
    $child_type = variable_get('book_child_type', 'book');
    if ($node && !empty($node->book) && (user_access('add content to books') || user_access('administer book outlines')) && node_access('create', $child_type) && $node->status == 1 && isset($node->book['depth']) && $node->book['depth'] < MENU_MAX_DEPTH) {
        $variables['tabs_extras'][200][] = '<hr>';
        $variables['tabs_extras'][200][] = l(t('Add child page'), 'node/add/' . str_replace('_', '-', $child_type), array('query' => array('parent' => $node->book['mlid'])));
    }
    if (user_access('access contextual links')) {
        $variables['tabs_extras'][0][] = '<li class="cis_accessibility_check"></li>';
    }
}
开发者ID:kreynen,项目名称:elmsln,代码行数:28,代码来源:template.php

示例4: cignaGlobal_css_alter

/**
 * Implements hook_css_alter().
 */
function cignaGlobal_css_alter(&$vars)
{
    $node = menu_get_object('node');
    if (is_object($node) && isset($node->type) && $node->type == 'landing_page') {
        unset($vars['sites/all/themes/cignaGlobal/css/style.css']);
    }
}
开发者ID:kevingreenancigna,项目名称:drupalProject,代码行数:10,代码来源:css.php

示例5: elearning_preprocess_book_navigation

/**
 * Preprocess for book-navigatoin.
 * @param array $vars
 */
function elearning_preprocess_book_navigation(&$vars)
{
    $node = menu_get_object('node');
    $vars['prev_title'] = t('Previous');
    $vars['next_title'] = t('Next');
    $course_items = course_get_items($node);
    $current_item = $vars['book_link']['nid'];
    $course_first_item = array_shift(array_keys($course_items));
    // if we are on first course_item then do not show the prev_url.
    if ($course_first_item == $current_item) {
        $vars['prev_url'] = '';
    }
    // Make sure prev_url is in course_item (to avoid links to unit content_type).
    $prev_item = book_prev($node->book);
    $prev_nid = explode('/', $prev_item['link_path']);
    foreach ($course_items as $key => $type) {
        if ($key == $current_item) {
            break;
        }
        $prev_course_item = $key;
    }
    if (!empty($prev_course_item) && !empty($prev_nid[1]) && $prev_course_item != $prev_nid[1]) {
        $vars['prev_url'] = url('node/' . $prev_course_item);
    }
    if (isset($node->outline_index)) {
        $vars['node_title'] = '<span class="outline-lesson-prefix">' . t('Lesson @i.', array('@i' => $node->outline_index)) . '</span>' . $node->title;
    }
}
开发者ID:rollinsb1010,项目名称:elearning,代码行数:32,代码来源:template.php

示例6: mvp_preprocess_html

function mvp_preprocess_html(&$vars)
{
    drupal_add_js(drupal_get_path('theme', 'mvp') . '/js/modernizr.min.js', array('scope' => 'header_scripts', 'every_page' => TRUE, 'weight' => 0));
    drupal_add_js(drupal_get_path('theme', 'mvp') . '/js/jquery-1.8.2.min.js', array('scope' => 'header', 'group' => JS_LIBRARY, 'every_page' => TRUE, 'weight' => 0));
    drupal_add_js(drupal_get_path('theme', 'mvp') . '/js/jquery-ui-1.10.4.min.js', array('scope' => 'header', 'group' => JS_LIBRARY, 'every_page' => TRUE, 'weight' => 3));
    if (request_uri() == '/content-dashboard') {
        drupal_add_js('(function($) {
      Drupal.behaviors.chosenSelects = {
        attach: function(context, settings) {
          $(".views-widget-filter-edit-type select#edit-type").chosen({
            width: "200px",
            placeholder_text_multiple: "Enter in a Content Type"
          });
          $(".views-widget-filter-edit-status-1 select").chosen({
            width: "200px",
            disable_search_threshold: 3
          });
        }
      };
    })(jQuery);', array('type' => 'inline', 'group' => JS_THEME, 'weight' => 2, 'defer' => TRUE));
    }
    $node = menu_get_object();
    if ($node && $node->nid) {
        $vars['theme_hook_suggestions'][] = 'html__' . $node->type;
    }
}
开发者ID:stevengrimaldo,项目名称:myvoipprovider,代码行数:26,代码来源:template.php

示例7: mooc_foundation_access_preprocess_page

/**
 * Implements template_preprocess_page.
 */
function mooc_foundation_access_preprocess_page(&$variables)
{
    // speedreader is enabled
    if (module_exists('speedreader')) {
        $variables['speedreader'] = TRUE;
    }
    // mespeak is enabled
    if (module_exists('mespeak')) {
        $variables['mespeak'] = TRUE;
    }
    // support for add child page shortcut
    $node = menu_get_object();
    if ($node && user_access('access printer-friendly version')) {
        $variables['tabs_extras'][200][] = '<hr>';
        $variables['tabs_extras'][200][] = l(t('Print'), 'book/export/html/' . arg(1));
    }
    $child_type = variable_get('book_child_type', 'book');
    if ($node && !empty($node->book) && (user_access('add content to books') || user_access('administer book outlines')) && node_access('create', $child_type) && $node->status == 1 && isset($node->book['depth']) && $node->book['depth'] < MENU_MAX_DEPTH) {
        $variables['tabs_extras'][200][] = '<hr>';
        $variables['tabs_extras'][200][] = l(t('Add child page'), 'node/add/' . str_replace('_', '-', $child_type), array('query' => array('parent' => $node->book['mlid'])));
    }
    if (user_access('access contextual links')) {
        $variables['tabs_extras'][0][] = '<li class="cis_accessibility_check"></li>';
    }
    // remove the prefix that provides a link to the home page
    // as MOOC is the thing that currently provides support directly for this
    // and slightly overrides the behavior
    $keys = array_keys($variables['page']['header']);
    $keyname = array_shift($keys);
    unset($variables['page']['header'][$keyname]['#prefix']);
}
开发者ID:ronaldmulero,项目名称:elmsln,代码行数:34,代码来源:template.php

示例8: storyscopezen_field__field_fb_tags

/**
* Overrides the theme_field for field_fb_tags to make it clickable and link to the Event Space (this will change).
*/
function storyscopezen_field__field_fb_tags($variables)
{
    if ($node = menu_get_object()) {
        // Get the nid
        $nid = $node->nid;
    }
    $output = '';
    $show_all = '';
    $path = drupal_lookup_path('alias', current_path());
    if (!empty($variables['items'][0])) {
        $show_all = l('<li class="tags">' . t('Show All') . '</li>', $path, array('html' => 'true', 'attributes' => array('target' => '_self'), 'query' => array('story' => $nid)));
        $output .= $show_all;
    }
    foreach ($variables['items'] as $item) {
        $fcid = key($item['entity']['field_collection_item']);
        if (!empty($item['entity']['field_collection_item'][$fcid]['field_mid'][0]['#markup'])) {
            $mid = $item['entity']['field_collection_item'][$fcid]['field_mid'][0]['#markup'];
        }
        if (!empty($item['entity']['field_collection_item'][$fcid]['field_topic'][0]['#markup'])) {
            $topic = $item['entity']['field_collection_item'][$fcid]['field_topic'][0]['#markup'];
        }
        if (!empty($mid) && !empty($topic)) {
            $id = explode('/', $mid);
            $lenth = count($id) - 1;
            $relative_mid = $id[$lenth];
            $tags_link = l('<li class="tags">' . $topic . '</li>', $path, array('html' => TRUE, 'attributes' => array('target' => '_self'), 'query' => array('tag' => '/m/' . $relative_mid)));
            $output .= $tags_link;
        } elseif (empty($mid) && !empty($topic)) {
            $output .= '<li class="tags freebase-link">' . $topic . '</li>';
        }
    }
    // Render the top-level UL.
    $output = '<ul class="' . $variables['classes'] . '"' . $variables['attributes'] . '>' . $output . '</ul>';
    return $output;
}
开发者ID:bridharr,项目名称:storyscope-lite,代码行数:38,代码来源:template.php

示例9: badm_preprocess_block

/**
 * Implements hook_preprocess_HOOK().
 */
function badm_preprocess_block(&$variables)
{
    // Add some region/page specifics.
    $region = $variables['block']->region;
    if (($node = menu_get_object()) && !arg(2)) {
        $variables['theme_hook_suggestions'][] = 'block__' . $region . '__' . $node->type;
    }
}
开发者ID:makinacorpus,项目名称:drupal-badm,代码行数:11,代码来源:template.php

示例10: theadmin_preprocess_page

/**
 * Preprocess functions for page.tpl.php.
 */
function theadmin_preprocess_page(&$vars)
{
    $node = menu_get_object();
    if (isset($node->nid) && $node->type == 'media_gallery') {
        $node_title = $node->title;
        $vars['title'] = '<span>edit: </span>' . $node_title;
    }
}
开发者ID:aimhighagency,项目名称:mjkim,代码行数:11,代码来源:template.php

示例11: singular_preprocess_node

/**
 * Implementation of preprocess_node().
 */
function singular_preprocess_node(&$vars) {
  $node = menu_get_object();
  if ($node === $vars['node']) {
    $vars['classes_array'][] = 'node-page';

    if (!isset($_GET['print'])) {
      unset($vars['title']);
    }
  }
}
开发者ID:nerdhaus,项目名称:singular,代码行数:13,代码来源:template.php

示例12: hippelicious_preprocess_node

/**
 * Implementation of preprocess_node().
 */
function hippelicious_preprocess_node(&$vars)
{
    $node = menu_get_object();
    if ($node === $vars['node']) {
        $vars['attr']['class'] .= ' node-page';
        if (!isset($_GET['print'])) {
            unset($vars['title']);
        }
    }
}
开发者ID:sireneast,项目名称:hippelicious,代码行数:13,代码来源:template.php

示例13: centroid_custom_form_alter

/**
 * Implements hook_form_alter().
 *
 * Adds the node a webform was submitted from for downloading purposes.
 *
 * Bit of functionality in the theme here... but it integrates with the
 * templates, so putting here seems most logical.
 */
function centroid_custom_form_alter(&$form, &$form_state, $form_id)
{
    if (strpos($form_id, 'webform_client_form') === 0 && !empty($form['submitted']['referring_nid'])) {
        if ($node = menu_get_object()) {
            if (property_exists($node, 'nid')) {
                $form['submitted']['referring_nid']['#value'] = $node->nid;
            }
        }
    }
}
开发者ID:macikokoro,项目名称:bootstrap-sass,代码行数:18,代码来源:template.php

示例14: dkan_process_zone

/**
 * Implements template_preprocess_zone().
 */
function dkan_process_zone(&$vars)
{
    if ($vars['zone'] == 'content') {
        $node = menu_get_object();
        $theme = alpha_get_theme();
        $tabs = dkan_theme_process_tabs($theme->page['tabs']);
        $vars['tabs'] = drupal_render($tabs);
        $vars['action_links'] = drupal_render($theme->page['action_links']);
    }
}
开发者ID:newswim,项目名称:dkan-drops-7,代码行数:13,代码来源:template.php

示例15: hook_workbench_block

/**
 * Return Workbench status information in a block.
 *
 * To reduce clutter, modules are encouraged to use this hook
 * to provide debugging and other relevant information.
 *
 * @return
 *   An array of message strings to print. The preferred format
 *   is a one line string in the format Title: <em>Message</em>.
 * @see workbench_block_view().
 */
function hook_workbench_block()
{
    // Add editing information to this page (if it's a node).
    if ($node = menu_get_object()) {
        if (node_access('update', $node)) {
            return array(t('My Module: <em>You may not edit this content.</em>'));
        } else {
            return array(t('My Module: <em>You may edit this content.</em>'));
        }
    }
}
开发者ID:Stony-Brook-University,项目名称:doitsbu,代码行数:22,代码来源:workbench.api.php


注:本文中的menu_get_object函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。