MDL-74887 course: Hide stealth mode without view page

This commit is contained in:
Stefan Hanauska 2022-09-10 20:08:29 +02:00
parent cc4fec275f
commit c4523503d2

View File

@ -213,6 +213,7 @@ abstract class moodleform_mod extends moodleform {
$this->_features->showdescription = plugin_supports('mod', $this->_modname, FEATURE_SHOW_DESCRIPTION, false);
$this->_features->gradecat = ($this->_features->outcomes or $this->_features->hasgrades);
$this->_features->advancedgrading = plugin_supports('mod', $this->_modname, FEATURE_ADVANCED_GRADING, false);
$this->_features->hasnoview = plugin_supports('mod', $this->_modname, FEATURE_NO_VIEW_LINK, false);
$this->_features->canrescale = (component_callback_exists('mod_' . $this->_modname, 'rescale_activity_grades') !== false);
}
@ -613,7 +614,10 @@ abstract class moodleform_mod extends moodleform {
$mform->addElement('header', 'modstandardelshdr', get_string('modstandardels', 'form'));
$section = get_fast_modinfo($COURSE)->get_section_info($this->_section);
$allowstealth = !empty($CFG->allowstealth) && $this->courseformat->allow_stealth_module_visibility($this->_cm, $section);
$allowstealth =
!empty($CFG->allowstealth) &&
$this->courseformat->allow_stealth_module_visibility($this->_cm, $section) &&
!$this->_features->hasnoview;
if ($allowstealth && $section->visible) {
$modvisiblelabel = 'modvisiblewithstealth';
} else if ($section->visible) {