Skip to content

Commit

Permalink
MDL-27829 blocks: added a warning to the block settings page that dis…
Browse files Browse the repository at this point in the history
…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 d097ad5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions blocks/edit_form.php
Expand Up @@ -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 {
Expand All @@ -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));
Expand Down
1 change: 1 addition & 0 deletions lang/en/block.php
Expand Up @@ -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';
Expand Down

0 comments on commit d097ad5

Please sign in to comment.