MDL-63001 core_form: final deprecation of the submitlink element

This commit is contained in:
Mark Nelson 2018-07-27 11:39:32 +08:00
parent 6e8235c7d3
commit 2dd3384083
3 changed files with 2 additions and 84 deletions

View File

@ -1,82 +0,0 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* submit link type form element
*
* Contains HTML class for a submitting to link
*
* @deprecated since 3.2
* @package core_form
* @copyright 2006 Jamie Pratt <me@jamiep.org>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
global $CFG;
require_once("$CFG->libdir/form/submit.php");
/**
* submit link type form element
*
* HTML class for a submitting to link
*
* @package core_form
* @category form
* @copyright 2006 Jamie Pratt <me@jamiep.org>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class MoodleQuickForm_submitlink extends MoodleQuickForm_submit {
/** @var string javascript for submitting element's data */
var $_js;
/** @var string callback function which will be called onclick event */
var $_onclick;
/**
* constructor
*
* @param string $elementName (optional) name of the field
* @param string $value (optional) field label
* @param string $attributes (optional) Either a typical HTML attribute string or an associative array
*/
public function __construct($elementName=null, $value=null, $attributes=null) {
debugging('Element type submitlink is deprecated.', DEBUG_DEVELOPER);
parent::__construct($elementName, $value, $attributes);
}
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function MoodleQuickForm_submitlink($elementName=null, $value=null, $attributes=null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $value, $attributes);
}
/**
* Returns HTML for submitlink form element.
*
* @return string
*/
function toHtml() {
$text = $this->_attributes['value'];
return "<noscript><div>" . parent::toHtml() . '</div></noscript><script type="text/javascript">' . $this->_js . "\n"
. 'document.write(\'<a href="#" onclick="' . $this->_onclick . '">'
. $text . "</a>');\n</script>";
}
}

View File

@ -3250,7 +3250,6 @@ MoodleQuickForm::registerElementType('selectwithlink', "$CFG->libdir/form/select
MoodleQuickForm::registerElementType('selectyesno', "$CFG->libdir/form/selectyesno.php", 'MoodleQuickForm_selectyesno');
MoodleQuickForm::registerElementType('static', "$CFG->libdir/form/static.php", 'MoodleQuickForm_static');
MoodleQuickForm::registerElementType('submit', "$CFG->libdir/form/submit.php", 'MoodleQuickForm_submit');
MoodleQuickForm::registerElementType('submitlink', "$CFG->libdir/form/submitlink.php", 'MoodleQuickForm_submitlink');
MoodleQuickForm::registerElementType('tags', "$CFG->libdir/form/tags.php", 'MoodleQuickForm_tags');
MoodleQuickForm::registerElementType('text', "$CFG->libdir/form/text.php", 'MoodleQuickForm_text');
MoodleQuickForm::registerElementType('textarea', "$CFG->libdir/form/textarea.php", 'MoodleQuickForm_textarea');

View File

@ -4,7 +4,7 @@ information provided here is intended especially for developers.
=== 3.6 ===
* Custom AJAX handlers for the form autocomplete fields can now optionally return string in their processResults()
callback. If a string is returned, it is displayed instead of the list if suggested items. This can be used, for
callback. If a string is returned, it is displayed instead of the list of suggested items. This can be used, for
example, to inform the user that there are too many items matching the current search criteria.
* The following functions have been finally deprecated and can not be used any more:
- external_function_info()
@ -22,6 +22,7 @@ information provided here is intended especially for developers.
- I set the field "<field_string>" to multiline
- I follow "<link_string>"" in the open menu
* Removed the lib/password_compat/lib/password.php file.
* Removed the lib/form/submitlink.php element which was deprecated in 3.2.
=== 3.5 ===