Merge branch 'MDL-38719'
This commit is contained in:
Vendored
+4
-1
@@ -49,7 +49,9 @@ class cachestore_addinstance_form extends moodleform {
|
||||
$locks = $this->_customdata['locks'];
|
||||
|
||||
$form->addElement('hidden', 'plugin', $plugin);
|
||||
$form->setType('plugin', PARAM_PLUGIN);
|
||||
$form->addElement('hidden', 'editing', !empty($this->_customdata['store']));
|
||||
$form->setType('editing', PARAM_BOOL);
|
||||
|
||||
if (!$store) {
|
||||
$form->addElement('text', 'name', get_string('storename', 'cache'));
|
||||
@@ -59,6 +61,7 @@ class cachestore_addinstance_form extends moodleform {
|
||||
} else {
|
||||
$form->addElement('hidden', 'name', $store);
|
||||
$form->addElement('static', 'name-value', get_string('storename', 'cache'), $store);
|
||||
$form->setType('name', PARAM_TEXT);
|
||||
}
|
||||
|
||||
if (is_array($locks)) {
|
||||
@@ -214,4 +217,4 @@ class cache_mode_mappings_form extends moodleform {
|
||||
|
||||
$this->add_action_buttons();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1261,6 +1261,15 @@ abstract class moodleform {
|
||||
case 'text':
|
||||
case 'url':
|
||||
$key = $element->getName();
|
||||
// For repeated elements we need to look for
|
||||
// the "main" type, not for the one present
|
||||
// on each repetition. All the stuff in formslib
|
||||
// (repeat_elements(), updateSubmission()... seems
|
||||
// to work that way.
|
||||
$pos = strpos($key, '[');
|
||||
if ($pos !== false) {
|
||||
$key = substr($key, 0, $pos);
|
||||
}
|
||||
if (!array_key_exists($key, $mform->_types)) {
|
||||
debugging("Did you remember to call setType() for '$key'? ".
|
||||
'Defaulting to PARAM_RAW cleaning.', DEBUG_DEVELOPER);
|
||||
|
||||
@@ -204,7 +204,12 @@ class formslib_test_form extends moodleform {
|
||||
$repeatels = array(
|
||||
$this->_form->createElement('text', 'text', 'Type something')
|
||||
);
|
||||
$this->repeat_elements($repeatels, 2, array(), 'numtexts', 'addtexts');
|
||||
// TODO: The repeat_elements() is far from perfect. Everything should be
|
||||
// repeated auto-magically by default with options only defining exceptions.
|
||||
// Surely this is caused because we are storing some element information OUT
|
||||
// from the element (type...) at form level. Anyway, the method should do its
|
||||
// work better, no matter of that.
|
||||
$this->repeat_elements($repeatels, 2, array('text' => array('type' => PARAM_RAW)), 'numtexts', 'addtexts');
|
||||
|
||||
$this->_form->addElement('radio', 'radio', 'Label', 'Choice label', 'choice_value');
|
||||
|
||||
@@ -217,4 +222,4 @@ class formslib_test_form extends moodleform {
|
||||
);
|
||||
$this->repeat_elements($repeatels, 3, array(), 'numradios', 'addradios');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user