Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
WCMS
uw_ct_event
Commits
3edfe5ee
Commit
3edfe5ee
authored
Dec 12, 2018
by
Eric Bremner
Browse files
ISTWCMS-2796: adding year and/or month to event archive page title
parent
0081e98c
Changes
1
Hide whitespace changes
Inline
Side-by-side
uw_ct_event.module
View file @
3edfe5ee
...
@@ -253,6 +253,34 @@ function uw_ct_event_form_alter(&$form, &$form_state, $form_id) {
...
@@ -253,6 +253,34 @@ function uw_ct_event_form_alter(&$form, &$form_state, $form_id) {
}
}
}
}
/**
* Implements hook_views_pre_render().
*
* Add the date to the title of the page.
*/
function
uw_ct_event_views_pre_render
(
&
$view
)
{
// If we are on a news archive page, change the title.
if
(
$view
->
name
==
'events_responsive'
&&
$view
->
current_display
==
'events_archive_page'
)
{
// Get the URL.
$args
=
arg
();
// The date for the news archive will always be the last part of the URL.
$date
=
end
(
$args
);
// If we have the format YYYY-MM, change title.
// If we dont have that format it is just YYYY.
if
(
preg_match
(
'/[0-9]{4}-[0-9]{1,2}/'
,
$date
))
{
$display_date
=
date
(
"F Y"
,
strtotime
(
$date
));
$view
->
build_info
[
'title'
]
=
'Events - '
.
$display_date
;
}
else
{
$view
->
build_info
[
'title'
]
=
'Events - '
.
$date
;
}
}
}
/**
/**
* Implements hook_views_pre_view().
* Implements hook_views_pre_view().
*/
*/
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment