MDL-52081 forms: Use __construct() for constructors
This commit is contained in:
@@ -75,12 +75,12 @@ class MoodleQuickForm_date_selector extends MoodleQuickForm_group {
|
||||
* @param array $options Options to control the element's display
|
||||
* @param mixed $attributes Either a typical HTML attribute string or an associative array
|
||||
*/
|
||||
function MoodleQuickForm_date_selector($elementName = null, $elementLabel = null, $options = array(), $attributes = null) {
|
||||
public function __construct($elementName = null, $elementLabel = null, $options = array(), $attributes = null) {
|
||||
// Get the calendar type used - see MDL-18375.
|
||||
$calendartype = \core_calendar\type_factory::get_calendar_instance();
|
||||
$this->_options = array('startyear' => $calendartype->get_min_year(), 'stopyear' => $calendartype->get_max_year(),
|
||||
'defaulttime' => 0, 'timezone' => 99, 'step' => 5, 'optional' => false);
|
||||
$this->HTML_QuickForm_element($elementName, $elementLabel, $attributes);
|
||||
HTML_QuickForm_element::__construct($elementName, $elementLabel, $attributes);
|
||||
$this->_persistantFreeze = true;
|
||||
$this->_appendName = true;
|
||||
$this->_type = 'date_selector';
|
||||
@@ -103,6 +103,16 @@ class MoodleQuickForm_date_selector extends MoodleQuickForm_group {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Old syntax of class constructor. Deprecated in PHP7.
|
||||
*
|
||||
* @deprecated since Moodle 3.1
|
||||
*/
|
||||
public function MoodleQuickForm_date_selector($elementName = null, $elementLabel = null, $options = array(), $attributes = null) {
|
||||
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
|
||||
self::__construct($elementName, $elementLabel, $options, $attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* This will create date group element constisting of day, month and year.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user