本文整理汇总了PHP中navigation_node::trim_if_empty方法的典型用法代码示例。如果您正苦于以下问题:PHP navigation_node::trim_if_empty方法的具体用法?PHP navigation_node::trim_if_empty怎么用?PHP navigation_node::trim_if_empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类navigation_node
的用法示例。
在下文中一共展示了navigation_node::trim_if_empty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: customcert_extend_settings_navigation
/**
* This function extends the settings navigation block for the site.
*
* It is safe to rely on PAGE here as we will only ever be within the module
* context when this is called.
*
* @param settings_navigation $settings
* @param navigation_node $customcertnode
*/
function customcert_extend_settings_navigation(settings_navigation $settings, navigation_node $customcertnode)
{
global $PAGE;
$keys = $customcertnode->get_children_key_list();
$beforekey = null;
$i = array_search('modedit', $keys);
if ($i === false and array_key_exists(0, $keys)) {
$beforekey = $keys[0];
} else {
if (array_key_exists($i + 1, $keys)) {
$beforekey = $keys[$i + 1];
}
}
if (has_capability('mod/customcert:manage', $PAGE->cm->context)) {
$node = navigation_node::create(get_string('editcustomcert', 'customcert'), new moodle_url('/mod/customcert/edit.php', array('cmid' => $PAGE->cm->id)), navigation_node::TYPE_SETTING, null, 'mod_customcert_edit', new pix_icon('t/edit', ''));
$customcertnode->add_node($node, $beforekey);
}
return $customcertnode->trim_if_empty();
}