Skip to content

Commit

Permalink
sectionhideingrid
Browse files Browse the repository at this point in the history
  • Loading branch information
gjb2048 committed Sep 28, 2024
1 parent 61f3b54 commit be8ec08
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
5 changes: 5 additions & 0 deletions classes/output/courseformat/content.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions lang/en/format_grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
16 changes: 16 additions & 0 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'])) {
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit be8ec08

Please sign in to comment.