MDL-52081 forms: Use __construct() for constructors

This commit is contained in:
Marina Glancy
2015-12-10 13:38:01 +08:00
parent 0dfcc2541a
commit 1a0df5535e
83 changed files with 1014 additions and 208 deletions
+12 -2
View File
@@ -53,8 +53,8 @@ class MoodleQuickForm_warning extends HTML_QuickForm_static{
* @param string $elementClass (optional) show as warning or notification => 'notifyproblem'
* @param string $text (optional) Text to put in warning field
*/
function MoodleQuickForm_warning($elementName=null, $elementClass='notifyproblem', $text=null) {
parent::HTML_QuickForm_static($elementName, null, $text);
public function __construct($elementName=null, $elementClass='notifyproblem', $text=null) {
parent::__construct($elementName, null, $text);
$this->_type = 'warning';
if (is_null($elementClass)) {
$elementClass = 'notifyproblem';
@@ -62,6 +62,16 @@ class MoodleQuickForm_warning extends HTML_QuickForm_static{
$this->_class = $elementClass;
}
/**
* Old syntax of class constructor. Deprecated in PHP7.
*
* @deprecated since Moodle 3.1
*/
public function MoodleQuickForm_warning($elementName=null, $elementClass='notifyproblem', $text=null) {
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
self::__construct($elementName, $elementClass, $text);
}
/**
* Returns HTML for this form element.
*