當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。