Skip to content
Snippets Groups Projects
Commit 1a4ea2b6 authored by Eric Bremner's avatar Eric Bremner
Browse files

Merge remote-tracking branch 'origin/feature/ISTWCMS-4213-ebremner-events-multi-type' into 8.x-1.x

Conflicts:
	src/Service/UWService.php
parents 14716b57 07177bfb
No related branches found
No related tags found
1 merge request!20ISTWCMS-4212: adding function to get correct short month name
...@@ -117,10 +117,17 @@ class UWService implements UWServiceInterface { ...@@ -117,10 +117,17 @@ class UWService implements UWServiceInterface {
// field_uw_<content_type>_date. // field_uw_<content_type>_date.
$field_name = 'field_uw_' . trim($teaser_type) . '_date'; $field_name = 'field_uw_' . trim($teaser_type) . '_date';
// Set the date variable, once returned to the calling function, they if (trim($teaser_type) == 'event') {
// can change the date format as required (i.e. change it to long-date $variables['date'] = $node->$field_name->getValue();
// or date-time). }
$variables['date'] = $node->$field_name->getString(); else {
// Set the date variable, once returned to the calling function,
// they can change the date format as required (i.e. change it
// to long-date or date-time).
$variables['date'] = $node->$field_name->getString();
}
break; break;
case 'author': case 'author':
...@@ -383,4 +390,31 @@ class UWService implements UWServiceInterface { ...@@ -383,4 +390,31 @@ class UWService implements UWServiceInterface {
return $front_page_path === $node_alias; return $front_page_path === $node_alias;
} }
/**
* {@inheritDoc}
*/
public function uwMonthNameShort(int $month = NULL) {
static $months = [
1 => 'Jan.',
2 => 'Feb.',
3 => 'Mar.',
4 => 'Apr.',
5 => 'May',
6 => 'June',
7 => 'July',
8 => 'Aug.',
9 => 'Sep.',
10 => 'Oct.',
11 => 'Nov.',
12 => 'Dec.',
];
if ($month) {
return $months[$month];
}
else {
return $months;
}
}
} }
...@@ -147,4 +147,16 @@ interface UWServiceInterface { ...@@ -147,4 +147,16 @@ interface UWServiceInterface {
*/ */
public function uwCountMenuItems(array $menu, int &$menu_items_count): void; public function uwCountMenuItems(array $menu, int &$menu_items_count): void;
/**
* A function to return the month short name.
*
* @param int $month
* An integer of the month.
*
* @return mixed
* A mixed variable that will either be a string of the short
* month with a period or array of all short months.
*/
public function uwMonthNameShort(int $month = NULL);
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment