本文整理匯總了PHP中navigation_node::get_title方法的典型用法代碼示例。如果您正苦於以下問題:PHP navigation_node::get_title方法的具體用法?PHP navigation_node::get_title怎麽用?PHP navigation_node::get_title使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類navigation_node
的用法示例。
在下文中一共展示了navigation_node::get_title方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: render_navigation_node
protected function render_navigation_node(navigation_node $item) {
$content = $item->get_content();
$title = $item->get_title();
if ($item->icon instanceof renderable && !$item->hideicon) {
$icon = $this->render($item->icon);
$content = $icon.$content; // use CSS for spacing of icons
}
if ($item->helpbutton !== null) {
$content = trim($item->helpbutton).html_writer::tag('span', $content, array('class'=>'clearhelpbutton'));
}
if ($content === '') {
return '';
}
if ($item->action instanceof action_link) {
//TODO: to be replaced with something else
$link = $item->action;
if ($item->hidden) {
$link->add_class('dimmed');
}
$content = $this->render($link);
} else if ($item->action instanceof moodle_url) {
$attributes = array();
if ($title !== '') {
$attributes['title'] = $title;
}
if ($item->hidden) {
$attributes['class'] = 'dimmed_text';
}
$content = html_writer::link($item->action, $content, $attributes);
} else if (is_string($item->action) || empty($item->action)) {
$attributes = array();
if ($title !== '') {
$attributes['title'] = $title;
}
if ($item->hidden) {
$attributes['class'] = 'dimmed_text';
}
$content = html_writer::tag('span', $content, $attributes);
}
return $content;
}
示例2: render_navigation_node
/**
* Renders a navigation node object.
*
* @param navigation_node $item The navigation node to render.
* @return string HTML fragment
*/
protected function render_navigation_node(navigation_node $item) {
$content = $item->get_content();
$title = $item->get_title();
if ($item->icon instanceof renderable && !$item->hideicon) {
$icon = $this->render($item->icon);
$content = $icon.$content; // use CSS for spacing of icons
}
if ($item->helpbutton !== null) {
$content = trim($item->helpbutton).html_writer::tag('span', $content, array('class'=>'clearhelpbutton', 'tabindex'=>'0'));
}
if ($content === '') {
return '';
}
if ($item->action instanceof action_link) {
$link = $item->action;
if ($item->hidden) {
$link->add_class('dimmed');
}
if (!empty($content)) {
// Providing there is content we will use that for the link content.
$link->text = $content;
}
$content = $this->render($link);
} else if ($item->action instanceof moodle_url) {
$attributes = array();
if ($title !== '') {
$attributes['title'] = $title;
}
if ($item->hidden) {
$attributes['class'] = 'dimmed_text';
}
$content = html_writer::link($item->action, $content, $attributes);
} else if (is_string($item->action) || empty($item->action)) {
$attributes = array('tabindex'=>'0'); //add tab support to span but still maintain character stream sequence.
if ($title !== '') {
$attributes['title'] = $title;
}
if ($item->hidden) {
$attributes['class'] = 'dimmed_text';
}
$content = html_writer::tag('span', $content, $attributes);
}
return $content;
}