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
ddbbdd30
Commit
ddbbdd30
authored
3 years ago
by
wodby
Browse files
Options
Downloads
Patches
Plain Diff
ISTWCMS-5088: showing all dates on node page
parent
b8af36b9
No related branches found
No related tags found
1 merge request
!147
ISTWCMS-5088: showing all dates on node page
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/Service/UWService.php
+16
-5
16 additions, 5 deletions
src/Service/UWService.php
src/Service/UWServiceInterface.php
+3
-1
3 additions, 1 deletion
src/Service/UWServiceInterface.php
with
19 additions
and
6 deletions
src/Service/UWService.php
+
16
−
5
View file @
ddbbdd30
...
...
@@ -350,7 +350,7 @@ class UWService implements UWServiceInterface {
break
;
case
'date'
:
$node_data
[
'date'
]
=
$this
->
uwGetDates
(
$node
,
$data
);
$node_data
[
'date'
]
=
$this
->
uwGetDates
(
$node
,
$data
,
$view_mode
);
break
;
case
'audience'
:
...
...
@@ -606,7 +606,7 @@ class UWService implements UWServiceInterface {
/**
* {@inheritDoc}
*/
public
function
uwGetDates
(
Node
$node
,
string
$field_name
):
array
{
public
function
uwGetDates
(
Node
$node
,
string
$field_name
,
string
$view_mode
):
array
{
$return_dates
=
[];
...
...
@@ -637,11 +637,22 @@ class UWService implements UWServiceInterface {
// out correct values.
foreach
(
$dates
as
$date
)
{
// Ensure that the dates are greater than timestamp
// that we generated above.
if
(
$date
[
'end_value'
]
>
$check_date
)
{
// ISTWCMS-5088: we need to ensure that at least
// some dates show on the node page, so let's just
// display them all.
// If not node page, only get dates in the future.
if
(
$view_mode
==
'full'
)
{
$return_dates
[]
=
$this
->
UwGetDate
(
$date
,
'event'
);
}
else
{
// Ensure that the dates are greater than timestamp
// that we generated above.
if
(
$date
[
'end_value'
]
>
$check_date
)
{
$return_dates
[]
=
$this
->
UwGetDate
(
$date
,
'event'
);
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
src/Service/UWServiceInterface.php
+
3
−
1
View file @
ddbbdd30
...
...
@@ -87,11 +87,13 @@ interface UWServiceInterface {
* Node entity.
* @param string $field_name
* The field name that has the date(s).
* @param string $view_mode
* The view mode of the node.
*
* @return array
* Array of dates.
*/
public
function
uwGetDates
(
Node
$node
,
string
$field_name
):
array
;
public
function
uwGetDates
(
Node
$node
,
string
$field_name
,
string
$view_mode
):
array
;
/**
* Get a date in the proper format.
...
...
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