本文整理汇总了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;
}
示例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);
}