I am now able to add menu item.
Updated code :
function local_setmotd_extends_settings_navigation(settings_navigation $settingsnav, context $context)
{
global $CFG, $PAGE;
/*
// Only let users with the appropriate capability see this settings item.
if( ! has_capability('local/setmotd:view', $context) )
{
return;
}
*/
$settingnode = $settingsnav->find('root', navigation_node::TYPE_SITE_ADMIN);
if( $settingnode )
{
$setMotdMenuLbl = get_string( 'menutitle','local_setmotd' );
$setMotdUrl = new moodle_url('/local/setmotd/set_motd.php');
$setMotdAdminNode = navigation_node::create(
$setMotdMenuLbl,
$setMotdUrl,
navigation_node::NODETYPE_LEAF);
file_put_contents('f:\chinanovation\my-logs\my-log.txt',"MA#".$PAGE->url."#".URL_MATCH_BASE);
if ($PAGE->url->compare($setMotdUrl, URL_MATCH_BASE)) {
$setMotdAdminNode->make_active();
}
$settingnode->add_node($setMotdAdminNode);
}
}
Re: Local plugin , menu item not getting added to Site Administration
by Bhargava S -
Number of replies: 0