Skip to content

Commit

Permalink
MDL-38855 blocks: Fix missing setType calls
Browse files Browse the repository at this point in the history
  • Loading branch information
David Monllao committed Apr 3, 2013
1 parent 29c1fb3 commit 238a657
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions blocks/edit_form.php
Expand Up @@ -89,6 +89,7 @@ function definition() {

$parentcontext = context::instance_by_id($this->block->instance->parentcontextid);
$mform->addElement('hidden', 'bui_parentcontextid', $parentcontext->id);
$mform->setType('bui_parentcontextid', PARAM_INT);

$mform->addElement('static', 'bui_homecontext', get_string('createdat', 'block'), print_context_name($parentcontext));
$mform->addHelpButton('bui_homecontext', 'createdat', 'block');
Expand All @@ -114,6 +115,7 @@ function definition() {

// Let the form to know about that, can be useful later
$mform->addElement('hidden', 'bui_editingatfrontpage', (int)$editingatfrontpage);
$mform->setType('bui_editingatfrontpage', PARAM_INT);

// Front page, show the page-contexts element and set $pagetypelist to 'any page' (*)
// as unique option. Processign the form will do any change if needed
Expand Down Expand Up @@ -145,6 +147,7 @@ function definition() {
$contextoptions[BUI_CONTEXTS_CURRENT_SUBS] = get_string('showoncontextandsubs', 'block', $parentcontextname);
$mform->addElement('select', 'bui_contexts', get_string('contexts', 'block'), $contextoptions);
}
$mform->setType('bui_contexts', PARAM_INT);

// Generate pagetype patterns by callbacks if necessary (has not been set specifically)
if (empty($pagetypelist)) {
Expand Down Expand Up @@ -175,6 +178,7 @@ function definition() {
$values = array_keys($pagetypelist);
$value = array_pop($values);
$mform->addElement('hidden', 'bui_pagetypepattern', $value);
$mform->setType('bui_pagetypepattern', PARAM_RAW);
// Now we are really hiding a lot (both page-contexts and page-type-patterns),
// specially in some systemcontext pages having only one option (my/user...)
// so, until it's decided if we are going to add the 'bring-back' pattern to
Expand All @@ -199,6 +203,7 @@ function definition() {
if ($this->page->subpage) {
if ($parentcontext->contextlevel == CONTEXT_USER) {
$mform->addElement('hidden', 'bui_subpagepattern', '%@NULL@%');
$mform->setType('bui_subpagepattern', PARAM_RAW);
} else {
$subpageoptions = array(
'%@NULL@%' => get_string('anypagematchingtheabove', 'block'),
Expand Down

0 comments on commit 238a657

Please sign in to comment.