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
e66a6335
Commit
e66a6335
authored
3 years ago
by
Eric Bremner
Committed by
Kevin Paxman
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
ISTWCMS-4947: ensure that location address and map either has values or null
parent
3a62c0d0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!127
ISTWCMS-4947: ensure that location address and map either has values or null
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Service/UWService.php
+42
-6
42 additions, 6 deletions
src/Service/UWService.php
with
42 additions
and
6 deletions
src/Service/UWService.php
+
42
−
6
View file @
e66a6335
...
...
@@ -316,7 +316,36 @@ class UWService implements UWServiceInterface {
break
;
case
'address'
:
$node_data
[
'address'
]
=
$node
->
$data
->
getValue
()[
0
];
// Set the address initially to null, if there are
// address values, then will be replaced.
$node_data
[
'address'
]
=
NULL
;
// Get the address value. There will always be a
// country code and administrative area, so we will
// have to check that there are at least values in
// address that we are using.
$address
=
$node
->
$data
->
getValue
()[
0
];
// Values that we are looking for so that the address
// can be displayed. If there is at least a value in
// this list, we display the address.
$address_values
=
[
'locality'
,
'postal_code'
,
'address_line1'
,
'address_line2'
,
];
// Step through each of the address values and check
// if there is a value in the field, if there is
// set the node data variable and exit the loop to
// save computational time.
foreach
(
$address_values
as
$address_value
)
{
if
(
$address
[
$address_value
])
{
$node_data
[
'address'
]
=
$address
;
break
;
}
}
break
;
case
'author'
:
...
...
@@ -357,11 +386,18 @@ class UWService implements UWServiceInterface {
break
;
case
'map'
:
$display
=
[
'type'
=>
'leaflet_formatter_default'
,
'label'
=>
'visually_hidden'
,
];
$node_data
[
'map'
]
=
$node
->
$data
->
view
(
$display
);
// Set the map initially to null, if there are
// coordinates, then will be replaced.
$node_data
[
'map'
]
=
NULL
;
// If there are coordinates, set the map.
if
(
$node
->
$data
->
getValue
())
{
$display
=
[
'type'
=>
'leaflet_formatter_default'
,
'label'
=>
'visually_hidden'
,
];
$node_data
[
'map'
]
=
$node
->
$data
->
view
(
$display
);
}
break
;
case
'sources'
:
...
...
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