MDL-55804 forms: Return exported data through _prepareValue
This commit is contained in:
@@ -262,7 +262,6 @@ class MoodleQuickForm_date_selector extends MoodleQuickForm_group {
|
||||
* @return array
|
||||
*/
|
||||
function exportValue(&$submitValues, $assoc = false) {
|
||||
$value = null;
|
||||
$valuearray = array();
|
||||
foreach ($this->_elements as $element){
|
||||
$thisexport = $element->exportValue($submitValues[$this->getName()], true);
|
||||
@@ -274,21 +273,20 @@ class MoodleQuickForm_date_selector extends MoodleQuickForm_group {
|
||||
if($this->_options['optional']) {
|
||||
// If checkbox is on, the value is zero, so go no further
|
||||
if(empty($valuearray['enabled'])) {
|
||||
$value[$this->getName()] = 0;
|
||||
return $value;
|
||||
return $this->_prepareValue(0, $assoc);
|
||||
}
|
||||
}
|
||||
// Get the calendar type used - see MDL-18375.
|
||||
$calendartype = \core_calendar\type_factory::get_calendar_instance();
|
||||
$gregoriandate = $calendartype->convert_to_gregorian($valuearray['year'], $valuearray['month'], $valuearray['day']);
|
||||
$value[$this->getName()] = make_timestamp($gregoriandate['year'],
|
||||
$value = make_timestamp($gregoriandate['year'],
|
||||
$gregoriandate['month'],
|
||||
$gregoriandate['day'],
|
||||
0, 0, 0,
|
||||
$this->_options['timezone'],
|
||||
true);
|
||||
|
||||
return $value;
|
||||
return $this->_prepareValue($value, $assoc);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user