Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
uw_cfg_common
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
WCMS
uw_cfg_common
Commits
3f881ab1
Commit
3f881ab1
authored
4 years ago
by
Eric Bremner
Browse files
Options
Downloads
Patches
Plain Diff
ISTWCMS-4212: adding function to get correct short month name
parent
becb8531
No related branches found
No related tags found
1 merge request
!20
ISTWCMS-4212: adding function to get correct short month name
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/Service/UWService.php
+38
-4
38 additions, 4 deletions
src/Service/UWService.php
src/Service/UWServiceInterface.php
+12
-0
12 additions, 0 deletions
src/Service/UWServiceInterface.php
with
50 additions
and
4 deletions
src/Service/UWService.php
+
38
−
4
View file @
3f881ab1
...
...
@@ -117,10 +117,17 @@ class UWService implements UWServiceInterface {
// field_uw_<content_type>_date.
$field_name
=
'field_uw_'
.
trim
(
$teaser_type
)
.
'_date'
;
// 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
();
if
(
trim
(
$teaser_type
)
==
'event'
)
{
$variables
[
'date'
]
=
$node
->
$field_name
->
getValue
();
}
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
;
case
'author'
:
...
...
@@ -368,4 +375,31 @@ class UWService implements UWServiceInterface {
}
}
/**
* {@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
;
}
}
}
This diff is collapsed.
Click to expand it.
src/Service/UWServiceInterface.php
+
12
−
0
View file @
3f881ab1
...
...
@@ -147,4 +147,16 @@ interface UWServiceInterface {
*/
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
);
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment