diff --git a/classes/output/courseformat/content.php b/classes/output/courseformat/content.php index 3f928905..145f1a40 100644 --- a/classes/output/courseformat/content.php +++ b/classes/output/courseformat/content.php @@ -376,6 +376,11 @@ protected function get_grid_sections(\renderer_base $output, $settings): array { continue; } + $sectionformatoptions = $format->get_format_options($thissection); + if ($sectionformatoptions['sectionhideingrid'] == 2) { // Yes. + continue; + } + $section = new stdClass(); $section->id = $thissection->id; $section->num = $thissection->section; diff --git a/lang/en/format_grid.php b/lang/en/format_grid.php index a5026cbd..cf0f1c67 100644 --- a/lang/en/format_grid.php +++ b/lang/en/format_grid.php @@ -74,6 +74,10 @@ $string['sectionbreakheading'] = 'Section break heading'; $string['sectionbreakheading_help'] = 'Show this heading at the point this section breaks in the grid. HTML can be used.'; +// Section hide in grid. +$string['sectionhideingrid'] = 'Hide section in grid'; +$string['sectionhideingrid_help'] = 'Do not show the section in the grid.'; + // Grid justification. $string['gridjustification'] = 'Set the justification of the grid'; $string['gridjustification_help'] = 'Set the justification to one of: Start, Centre, End, Space around, Space between or Space evenly'; diff --git a/lib.php b/lib.php index 56f267fb..11d37bdd 100755 --- a/lib.php +++ b/lib.php @@ -789,6 +789,10 @@ public function section_format_options($foreditform = false) { 'default' => '', 'type' => PARAM_RAW, ], + 'sectionhideingrid' => [ + 'default' => 1, // No. + 'type' => PARAM_INT, + ], ]; } if ($foreditform && !isset($sectionformatoptions['sectionimage_filemanager']['label'])) { @@ -829,6 +833,18 @@ public function section_format_options($foreditform = false) { 'help_component' => 'format_grid', 'element_type' => 'textarea', ], + 'sectionhideingrid' => [ + 'label' => new lang_string('sectionhideingrid', 'format_grid'), + 'help' => 'sectionhideingrid', + 'help_component' => 'format_grid', + 'element_type' => 'select', + 'element_attributes' => [ + [ + 1 => new lang_string('no'), + 2 => new lang_string('yes'), + ], + ], + ], ]; $sectionformatoptions = array_merge_recursive($sectionformatoptions, $sectionformatoptionsedit); }