Skip to content

Commit

Permalink
Better removal of admin settings and navigation blocks to prevent JS …
Browse files Browse the repository at this point in the history
…'settingsblock.js' error on the console when it can't find the instanceid in the init method.
  • Loading branch information
gjb2048 committed Jun 30, 2023
1 parent 01e2e25 commit 153bd38
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
13 changes: 2 additions & 11 deletions classes/output/core_renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -606,10 +606,6 @@ public function blocks_for_region($region, $fakeblocksonly = false) {
$numblocks = 1; // Take into account the fake flat navigation block.
foreach ($blockcontents as $bc) {
if ($bc instanceof block_contents) {
if (($bc->attributes['data-block'] == 'navigation') || ($bc->attributes['data-block'] == 'settings')) {
continue;
}

$numblocks++;
} else if ($bc instanceof block_move_target) {
$numblocks++;
Expand Down Expand Up @@ -676,11 +672,8 @@ public function blocks_for_region($region, $fakeblocksonly = false) {
// One block column.
foreach ($blockcontents as $bc) {
if ($bc instanceof block_contents) {
if (($bc->attributes['data-block'] == 'navigation') || ($bc->attributes['data-block'] == 'settings')) {
continue;
}

$thisblock = $this->block($bc, $region);
// TODO: Not sure if this is needed anymore?
if ($bc->attributes['data-block'] == 'adminblock') {
$bc->blockinstanceid = -1;
$thisblock->blockinstanceid = $bc->blockinstanceid;
Expand Down Expand Up @@ -711,12 +704,10 @@ public function blocks_for_region($region, $fakeblocksonly = false) {
$block->name = 'block_' . $block->attributes['data-block'];
}
$block->shape = 'squared';
// TODO: Not sure if this is needed anymore?
if ($block->name == "block_adminblock") {
$block->blockinstanceid = -1;
}
if ($block->name == "block_settings") {
$block->subopen = true;
}

if ($count == 2) {
$pair->blockb = $block;
Expand Down
1 change: 1 addition & 0 deletions config.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,3 +154,4 @@

$THEME->iconsystem = '\\theme_squared\\output\\icon_system_fontawesome';
$THEME->haseditswitch = true;
$THEME->requiredblocks = '';

0 comments on commit 153bd38

Please sign in to comment.