Commit 55c09189 authored by Liam Morland's avatar Liam Morland
Browse files

RT#801775: Always return array from uw_ct_event_get_year_array()

Fixes bug introduced in 077a00cd. If uw_ct_event_get_year_array() does
not return an array, the subsequent call to
uw_ct_event_get_combine_year_array() will cause an error due to the
array type hints.
parent e2fbc617
......@@ -1681,6 +1681,9 @@ function uw_ct_event_get_taxonomy_term_from_url() {
* Get year array from field_data_field_event_date table.
*
* Field_event_date_value and field_event_date_value2.
*
* @return array
* The year array.
*/
function uw_ct_event_get_year_array() {
$query = "SELECT YEAR(TIMESTAMPADD(SECOND,field_event_date_offset,STR_TO_DATE(field_data_field_event_date.field_event_date_value, '%Y-%m-%dT%T'))) AS year,
......@@ -1689,10 +1692,13 @@ function uw_ct_event_get_year_array() {
WHERE node.type = 'uw_event' AND node.status = 1
ORDER BY year DESC";
$result = db_query($query);
$return = FALSE;
$return = [
1 => [],
2 => [],
];
foreach ($result as $id => $record) {
$return['1'][] = $record->year;
$return['2'][] = $record->year2;
$return[1][] = $record->year;
$return[2][] = $record->year2;
}
return $return;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment