Permalink
Browse files

MDL-27829 blocks: added a warning to the block settings page that dis…

…plays when the block was using a block type we dont let users select anymore
  • Loading branch information...
andyjdavis committed Jun 30, 2011
1 parent 096928c commit d097ad564df6facad0e6cf8937b91610eeb61d62
Showing with 11 additions and 0 deletions.
  1. +10 −0 blocks/edit_form.php
  2. +1 −0 lang/en/block.php
View
@@ -126,6 +126,7 @@ function definition() {
$mform->addElement('select', 'bui_contexts', get_string('contexts', 'block'), $contextoptions);
}
+ $displaypagetypewarning = false;
if ($this->page->pagetype == 'site-index') { // No need for pagetype list on home page
$pagetypelist = array('*'=>get_string('page-x', 'pagetype'));
} else {
@@ -139,12 +140,21 @@ function definition() {
} else {
//as a last resort we could put the page type pattern in the select box
//however this causes mod-data-view to be added if the only option available is mod-data-*
+
+ //as a last resort we could put the page type pattern in the select box
+ //however this causes mod-data-view to be added if the only option available is mod-data-*
+ // so we are just showing a warning to users about their prev setting being reset
+ $displaypagetypewarning = true;
}
}
}
// hide page type pattern select box if there is only one choice
if (count($pagetypelist) > 1) {
+ if ($displaypagetypewarning) {
+ $mform->addElement('static', 'pagetypewarning', '', get_string('pagetypewarning','block'));
+ }
+
$mform->addElement('select', 'bui_pagetypepattern', get_string('restrictpagetypes', 'block'), $pagetypelist);
} else {
$value = array_pop(array_keys($pagetypelist));
View
@@ -41,6 +41,7 @@
$string['movingthisblockcancel'] = 'Moving this block ({$a})';
$string['onthispage'] = 'On this page';
$string['pagetypes'] = 'Page types';
+$string['pagetypewarning'] = 'The previously specified page type is no longer selectable. Please choose the most appropriate page type below.';
$string['region'] = 'Region';
$string['showoncontextandsubs'] = 'Display on \'{$a}\' and any pages within it';
$string['showoncontextonly'] = 'Display on \'{$a}\' only';

0 comments on commit d097ad5

Please sign in to comment.