• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP menu_get_object函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: handbuilt_preprocess_region_content_sidebar_left

function handbuilt_preprocess_region_content_sidebar_left(&$variables)
{
    $top_border = '';
    for ($i = 0; $i < 27; $i++) {
        $top_border .= '<span class="t t-r"></span><span class="t t-l"></span>';
    }
    $variables['content'] = $top_border . $variables['content'];
    if (_ebr_is_node_page('essay')) {
        $essay = menu_get_object();
        $variables['classes_array'][] = 'thread-' . $essay->thread_name;
    }
}
开发者ID:ebranda,项目名称:electronicbookreview,代码行数:12,代码来源:template.php


示例17: bht_theme_preprocess_html

/**
 * Implements template_preprocess_html().
 */
function bht_theme_preprocess_html(&$variables)
{
    // Define important css classes.
    $classes_to_keep = array('front', 'page-taxonomy-term');
    // Add the node type class to the classes to keep list.
    $nodetype = preg_grep('/^node-type/', $variables['classes_array']);
    if ($nodetype) {
        $type = current($nodetype);
        $classes_to_keep[$type] = TRUE;
    }
    // Strip all CSS classes but and keep the important ones.
    foreach ($variables['classes_array'] as $key => $class) {
        if (!in_array($class, $classes_to_keep)) {
            unset($variables['classes_array'][$key]);
        }
    }
    if (isset($type) && $type == 'node-type-events') {
        $node = menu_get_object();
        if ($node->promote) {
            $variables['classes_array'][] = 'node-type-events-promote';
        }
    }
    // Add critical css inline #perfmatters.
    if (!(bool) variable_get('bht_production', FALSE)) {
        // Read critical css file contents.
        $critical_css = file_get_contents(path_to_theme() . '/css/critical.min.css');
        // Replace css folder relative paths to site related relative paths.
        $critical_css = str_replace('../', base_path() . path_to_theme() . '/', $critical_css);
        drupal_add_css($critical_css, array('type' => 'inline', 'weight' => 1000, 'group' => CSS_THEME));
    }
    // Add the production or development javascript files #perfmatters.
    if (!(bool) variable_get('bht_production', FALSE)) {
        drupal_add_js(path_to_theme() . '/js/production.min.js', 'file');
    } else {
        // Remember to alter gruntfile.js to generate a correct production.min.js file.
        /*drupal_add_js(path_to_theme() . '/js/jquery.colorbox-min.js', 'file');*/
        /*drupal_add_js(path_to_theme() . '/js/jquery.fitvids-min.js', 'file');*/
        /*drupal_add_js(path_to_theme() . '/js/jquery.scrollto.min.js', 'file');*/
        drupal_add_js(path_to_theme() . '/js/scripts.js', 'file');
    }
    // Add theme folder to the variables.
    $variables['theme_folder'] = base_path() . path_to_theme() . '/';
    // Add themePath to drupal settings, cfr. existing basePath.
    $extra_js_settings = array('themePath' => $variables['theme_folder']);
    drupal_add_js($extra_js_settings, 'setting');
    // Strip out wbr character
    if (isset($variables['head_title_array']['title'])) {
        $variables['head_title_array']['title'] = str_replace('||', '', $variables['head_title_array']['title']);
    }
    if (isset($variables['head_title'])) {
        $variables['head_title'] = str_replace('||', '', $variables['head_title']);
    }
}
开发者ID:TBeeckmans,项目名称:bht,代码行数:56,代码来源:template.php


示例18: whaleocalypse_preprocess_page

/**
 * Implements theme_preprocess_page.
 * This fixes a bug in top_node where the page title fails to show up.
 *
 * @todo
 *   Generalize this fix to respect views page title settings and contribute it
 *   back to the top node project.  While we're at it, try and fix that problem
 *   where top_node replaces the $_GET['q'] variable.
 */
function whaleocalypse_preprocess_page(&$vars)
{
    $node = menu_get_object();
    if (is_object($node) && $node->type == 'comic') {
        $vars['title'] = l($node->title, 'node/' . $node->nid);
    }
    if ($vars['logo']) {
        //pass the site logo through the l() function
        $logo_image = '<img src="' . $vars['logo'] . '" alt="Home"/>';
        $vars['logo'] = l($logo_image, 'main', array("html" => TRUE, "attributes" => array("title" => "Home", "rel" => "home", "id" => "logo")));
    }
}
开发者ID:ridho7uliansyah,项目名称:0xPc50ff3ns1v3,代码行数:21,代码来源:template.php


示例19: banner_redirect

function banner_redirect()
{
    $node = menu_get_object();
    if ($node && $node->type == 'banner_image') {
        banner_debug("functions remove line 47");
        $node->field_hits['und'][0]['value']++;
        $node->field_last_accessed['und'][0]['value'] = time();
        node_save($node);
        $data = array('nid' => $node->nid, 'referer' => $_SERVER['HTTP_REFERER'], 'remote' => $_SERVER['REMOTE_ADDR'], 'dest' => $node->field_url['und'][0]['url'], 'time' => time());
        hit_stat($data);
    }
}
开发者ID:vishacc,项目名称:libyanwarthetruth,代码行数:12,代码来源:functions.php


示例20: radicaldesigns_preprocess_html

function radicaldesigns_preprocess_html(&$variables)
{
    //If on an individual node page, add the node type to body classes.
    if ($node = menu_get_object()) {
        if (isset($node->body['und'])) {
            //check if there's a body on this node
            if (strlen($node->body['und'][0]['value']) > 10) {
                //check it's got at least ten chars of text
                $GLOBALS['body_sample'] = substr(strip_tags($node->body['und'][0]['value']), 0, 200);
            }
        }
    }
}
开发者ID:radicaldesigns,项目名称:drupal-base,代码行数:13,代码来源:template.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP menu_insert函数代码示例发布时间:2022-05-15
下一篇:
PHP menu_get_menus函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap