Skip to content

Commit

Permalink
Fix 'Orphaned sections problem when adding sections', a regression ca…
Browse files Browse the repository at this point in the history
…used by 'Use section anchors in links when editing - pt 2' - #223.
  • Loading branch information
gjb2048 committed Sep 30, 2024
1 parent 9031485 commit 8886710
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ History

Version 404.1.3 - In development
--------------------------------
1. Fix 'Orphaned sections problem when adding sections', a regression caused by
'Use section anchors in links when editing - pt 2' - #223.

Version 404.1.2.5 - 28/09/2024
------------------------------
Expand Down
5 changes: 3 additions & 2 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1001,10 +1001,11 @@ public function section_deleted() {
* @param bool $add Add a section or delete if false.
*/
protected function change_gnumsections($add) {
$currentsettings = $this->get_settings();
if ($add) {
$newgnumsetions = $this->settings['gnumsections'] + 1;
$newgnumsetions = $currentsettings['gnumsections'] + 1;
} else {
$newgnumsetions = $this->settings['gnumsections'] - 1;
$newgnumsetions = $currentsettings['gnumsections'] - 1;
}
$data = ['gnumsections' => $newgnumsetions];
$this->update_format_options($data);
Expand Down

0 comments on commit 8886710

Please sign in to comment.