Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
Eloy Lafuente (stronk7) stronk7 authored

Showing 1 changed file with 7 additions and 0 deletions. Show diff stats Hide diff stats

  1. +7 0 lib/blocklib.php
7 lib/blocklib.php
@@ -1661,6 +1661,13 @@ function generate_page_type_patterns($pagetype, $parentcontext = null, $currentc
1661 1661 $patterns = default_page_type_list($pagetype, $parentcontext, $currentcontext);
1662 1662 }
1663 1663
  1664 + // Ensure that the * pattern is always available if editing block 'at distance', so
  1665 + // we always can 'bring back' it to the original context. MDL-30340
  1666 + if ($currentcontext->id != $parentcontext->id && !isset($patterns['*'])) {
  1667 + // TODO: We could change the string here, showing its 'bring back' meaning
  1668 + $patterns['*'] = get_string('page-x', 'pagetype');
  1669 + }
  1670 +
1664 1671 return $patterns;
1665 1672 }
1666 1673

0 comments on commit 4e1e5c8

Please sign in to comment.
Something went wrong with that request. Please try again.