From b16dca435aeaa0e2dc783deee537f0e7f3c53649 Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Wed, 19 Jul 2017 09:30:03 +0800 Subject: [PATCH] MDL-59388 calendar: Add data-time to calendar navigation links --- calendar/lib.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/calendar/lib.php b/calendar/lib.php index 77df74eaab7..55a12be7192 100644 --- a/calendar/lib.php +++ b/calendar/lib.php @@ -2173,7 +2173,11 @@ function calendar_get_link_previous($text, $linkbase, $d, $m, $y, $accesshide = return $text; } - return link_arrow_left($text, (string)$href, $accesshide, 'previous'); + $attrs = [ + 'data-time' => calendar_get_timestamp($d, $m, $y, $time), + ]; + + return link_arrow_left($text, $href->out(false), $accesshide, 'previous', $attrs); } /** @@ -2196,7 +2200,11 @@ function calendar_get_link_next($text, $linkbase, $d, $m, $y, $accesshide = fals return $text; } - return link_arrow_right($text, (string)$href, $accesshide, 'next'); + $attrs = [ + 'data-time' => calendar_get_timestamp($d, $m, $y, $time), + ]; + + return link_arrow_right($text, $href->out(false), $accesshide, 'next', $attrs); } /**