MDL-57471 forms: deprecate init_javascript_enhancement()
This was half-finished and only used for the smartselect enhancement. That enhancement doesn't work with theme_boost and is better replaced just using the searchableselector element.
This commit is contained in:
+3
-19
@@ -1240,31 +1240,15 @@ abstract class moodleform {
|
||||
* $enhancement = 'smartselect';
|
||||
* $options = array('selectablecategories' => true|false)
|
||||
*
|
||||
* @since Moodle 2.0
|
||||
* @param string|element $element form element for which Javascript needs to be initalized
|
||||
* @param string $enhancement which init function should be called
|
||||
* @param array $options options passed to javascript
|
||||
* @param array $strings strings for javascript
|
||||
* @deprecated since Moodle 3.3 MDL-57471
|
||||
*/
|
||||
function init_javascript_enhancement($element, $enhancement, array $options=array(), array $strings=null) {
|
||||
global $PAGE;
|
||||
if (is_string($element)) {
|
||||
$element = $this->_form->getElement($element);
|
||||
}
|
||||
if (is_object($element)) {
|
||||
$element->_generateId();
|
||||
$elementid = $element->getAttribute('id');
|
||||
$PAGE->requires->js_init_call('M.form.init_'.$enhancement, array($elementid, $options));
|
||||
if (is_array($strings)) {
|
||||
foreach ($strings as $string) {
|
||||
if (is_array($string)) {
|
||||
call_user_func_array(array($PAGE->requires, 'string_for_js'), $string);
|
||||
} else {
|
||||
$PAGE->requires->string_for_js($string, 'moodle');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
debugging('$mform->init_javascript_enhancement() is deprecated and no longer does anything. '.
|
||||
'smartselect uses should be converted to the searchableselector form element.', DEBUG_DEVELOPER);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user