Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-30340 blocks - avoid lockin'blocks in subcontexts.

Everytime that one block instance is edited @ any subcontext,
guarantee that the 'bring back' pattern (* = all pages) is
available, so the block can be reseted to its original context
  • Loading branch information...
commit 4e1e5c8db68c8407422d9ba485b14b84678512a9 1 parent 6508da4
@stronk7 stronk7 authored
Showing with 7 additions and 0 deletions.
  1. +7 −0 lib/blocklib.php
View
7 lib/blocklib.php
@@ -1661,6 +1661,13 @@ function generate_page_type_patterns($pagetype, $parentcontext = null, $currentc
$patterns = default_page_type_list($pagetype, $parentcontext, $currentcontext);
}
+ // Ensure that the * pattern is always available if editing block 'at distance', so
+ // we always can 'bring back' it to the original context. MDL-30340
+ if ($currentcontext->id != $parentcontext->id && !isset($patterns['*'])) {
+ // TODO: We could change the string here, showing its 'bring back' meaning
+ $patterns['*'] = get_string('page-x', 'pagetype');
+ }
+
return $patterns;
}
Please sign in to comment.
Something went wrong with that request. Please try again.