From d097ad564df6facad0e6cf8937b91610eeb61d62 Mon Sep 17 00:00:00 2001 From: "Andrew Davis (andyjdavis)" Date: Thu, 30 Jun 2011 17:35:15 +0800 Subject: [PATCH] MDL-27829 blocks: added a warning to the block settings page that displays when the block was using a block type we dont let users select anymore --- blocks/edit_form.php | 10 ++++++++++ lang/en/block.php | 1 + 2 files changed, 11 insertions(+) diff --git a/blocks/edit_form.php b/blocks/edit_form.php index e5bcc8c387e0d..c5280938a42fc 100644 --- a/blocks/edit_form.php +++ b/blocks/edit_form.php @@ -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)); diff --git a/lang/en/block.php b/lang/en/block.php index 65b4fce962375..c0b8f01c1f6a7 100644 --- a/lang/en/block.php +++ b/lang/en/block.php @@ -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';