最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

php - How to add a custom tab in the main course navigation bar, not in the "More" menu? - Stack Overflow

programmeradmin1浏览0评论

I am developing a block plugin for Moodle, and I want to add a custom tab to the main course navigation bar (directly visible, not hidden under the "More" menu). Currently, my code adds the tab to the "More" menu. Here’s what I have so far:

$context = context_course::instance($COURSE->id);
$coursenode = $PAGE->settingsnav->find('courseadmin', navigation_node::TYPE_COURSE);

if ($coursenode) {
    $node = navigation_node::create(
        get_string('myblock', 'block_myblock'),
        new moodle_url('/blocks/myblock/view.php', ['courseid' => $COURSE->id]),
        navigation_node::TYPE_SETTING,
        null,
        'customnode',
        new pix_icon('i/settings', '')
    );

    $node->showinflatnavigation = true;
    $node->forceintomoremenu = false;
    $node->showinsecondarynavigation = true;
    $node->display = true;

    $coursenode->add_node($node, 'filtermanagement');
    $node->make_active();
    $node->force_open();
}

The tab is currently added under the "More" menu instead of being directly visible in the course navigation bar.

How can I ensure that my custom tab appears directly in the main course navigation bar and not under "More"?

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论