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


PHP core_renderer::render_custom_menu_item方法代码示例

本文整理汇总了PHP中core_renderer::render_custom_menu_item方法的典型用法代码示例。如果您正苦于以下问题:PHP core_renderer::render_custom_menu_item方法的具体用法?PHP core_renderer::render_custom_menu_item怎么用?PHP core_renderer::render_custom_menu_item使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在core_renderer的用法示例。


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

示例1: render_custom_menu_item

 /**
  * Renders a custom menu node as part of a submenu
  *
  * The custom menu this method override the render_custom_menu_item function
  * in outputrenderers.php
  *
  * @see render_custom_menu()
  *
  * @staticvar int $submenucount
  * @param custom_menu_item $menunode
  * @return string
  */
 protected function render_custom_menu_item(custom_menu_item $menunode)
 {
     if (!right_to_left()) {
         // Keep YUI3 navmenu for LTR UI
         parent::render_custom_menu_item($menunode);
     }
     // Required to ensure we get unique trackable id's
     static $submenucount = 0;
     $content = html_writer::start_tag('li');
     if ($menunode->has_children()) {
         // If the child has menus render it as a sub menu
         $submenucount++;
         if ($menunode->get_url() !== null) {
             $url = $menunode->get_url();
         } else {
             $url = '#cm_submenu_' . $submenucount;
         }
         $content .= html_writer::start_tag('span', array('class' => 'customitem'));
         $content .= html_writer::link($url, $menunode->get_text(), array('title' => $menunode->get_title()));
         $content .= html_writer::end_tag('span');
         $content .= html_writer::start_tag('ul');
         foreach ($menunode->get_children() as $menunode) {
             $content .= $this->render_custom_menu_item($menunode);
         }
         $content .= html_writer::end_tag('ul');
     } else {
         // The node doesn't have children so produce a final menuitem
         if ($menunode->get_url() !== null) {
             $url = $menunode->get_url();
         } else {
             $url = '#';
         }
         $content .= html_writer::link($url, $menunode->get_text(), array('title' => $menunode->get_title()));
     }
     $content .= html_writer::end_tag('li');
     // Return the sub menu
     return $content;
 }
开发者ID:nadavkav,项目名称:Moodle2-Hebrew-plugins,代码行数:50,代码来源:renderers.php

示例2: render_custom_menu_item

 protected function render_custom_menu_item(custom_menu_item $menunode)
 {
     $transmutedmenunode = new theme_archaius_transmuted_custom_menu_item($menunode);
     return parent::render_custom_menu_item($transmutedmenunode);
 }
开发者ID:sdc,项目名称:moodle-theme_archaius,代码行数:5,代码来源:renderers.php


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