protected function add_context_locking_node(\navigation_node $node, \context $context) {
        global $CFG;
        // Manage context locking.
        if (!empty($CFG->contextlocking) && has_capability('moodle/site:managecontextlocks', $context)) {
            $parentcontext = $context->get_parent_context();
            if (empty($parentcontext) || !$parentcontext->locked) {
                if ($context->locked) {
                    $lockicon = 'i/unlock';
                    $lockstring = get_string('managecontextunlock', 'admin');
                } else {
                    $lockicon = 'i/lock';
                    $lockstring = get_string('managecontextlock', 'admin');
                }
                $node->add(
                    $lockstring,
                    new moodle_url(
                        '/admin/lock.php',
                        [
                            'id' => $context->id,
                        ]
                    ),
                    self::TYPE_SETTING,
                    null,
                    'contextlocking',
                     new pix_icon($lockicon, '')
                );
            }
        }

    }