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
7e6f4548
Commit
7e6f4548
authored
2 years ago
by
Eric Bremner
Committed by
Kevin Paxman
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
ISTWCMS-5880: adding function to get the media flags
parent
7bf834ac
No related branches found
No related tags found
3 merge requests
!284
Feature/istwcms 5880 ebremner banners above
,
!274
Draft: ISTWCMS-5551: fixing office hours display
,
!260
Feature/istwcms 5668 a5kulkar rename references to publications
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/Service/UWService.php
+40
-0
40 additions, 0 deletions
src/Service/UWService.php
src/Service/UWServiceInterface.php
+11
-0
11 additions, 0 deletions
src/Service/UWServiceInterface.php
src/Service/UwNodeFieldValue.php
+1
-0
1 addition, 0 deletions
src/Service/UwNodeFieldValue.php
with
52 additions
and
0 deletions
src/Service/UWService.php
+
40
−
0
View file @
7e6f4548
...
@@ -247,6 +247,46 @@ class UWService implements UWServiceInterface {
...
@@ -247,6 +247,46 @@ class UWService implements UWServiceInterface {
return
$preprocess
;
return
$preprocess
;
}
}
/**
* {@inheritDoc}
*/
public
function
uwGetMediaFlags
(
Node
$node
):
array
{
// Set the defaults for the flags to false.
$media_flags
[
'has_media'
]
=
FALSE
;
$media_flags
[
'show_header_in_media'
]
=
FALSE
;
// If there is a type of media field, continue to look
// for media flags.
if
(
$node
->
hasField
(
'field_uw_type_of_media'
))
{
// If there is a type of media set, then set has_media,
// and look for media in header.
if
(
$type_of_media
=
$node
->
field_uw_type_of_media
->
value
)
{
// Set has_media flag.
$media_flags
[
'has_media'
]
=
TRUE
;
// If the type of media is image, the header needs to
// go inside the media, so set the flag.
if
(
$type_of_media
==
'image'
)
{
$media_flags
[
'show_header_in_media'
]
=
TRUE
;
}
}
// Special case is contact, we need to look if there
// is a portrait image and if so set the has_media.
else
if
(
$node
->
getType
()
==
'uw_ct_contact'
)
{
// If there is a portrait image, set the has_media.
if
(
$node
->
field_uw_ct_contact_image
->
getValue
())
{
$media_flags
[
'has_media'
]
=
TRUE
;
}
}
}
return
$media_flags
;
}
/**
/**
* {@inheritDoc}
* {@inheritDoc}
*/
*/
...
...
This diff is collapsed.
Click to expand it.
src/Service/UWServiceInterface.php
+
11
−
0
View file @
7e6f4548
...
@@ -59,6 +59,17 @@ interface UWServiceInterface {
...
@@ -59,6 +59,17 @@ interface UWServiceInterface {
*/
*/
public
function
uwGetNodePreprocessing
(
string
$type
):
array
;
public
function
uwGetNodePreprocessing
(
string
$type
):
array
;
/**
* Gets the flags for showing media on nodes.
*
* @param \Drupal\node\Node $node
* Node entity.
*
* @return array
* Array of flags for media.
*/
public
function
uwGetMediaFlags
(
Node
$node
):
array
;
/**
/**
* Gets dates from node.
* Gets dates from node.
*
*
...
...
This diff is collapsed.
Click to expand it.
src/Service/UwNodeFieldValue.php
+
1
−
0
View file @
7e6f4548
...
@@ -317,6 +317,7 @@ class UwNodeFieldValue {
...
@@ -317,6 +317,7 @@ class UwNodeFieldValue {
'style'
=>
$node
->
field_uw_text_overlay_style
->
value
,
'style'
=>
$node
->
field_uw_text_overlay_style
->
value
,
'transition_speed'
=>
$node
->
field_uw_transition_speed
->
value
,
'transition_speed'
=>
$node
->
field_uw_transition_speed
->
value
,
'media_width'
=>
$media_width_classes
??
NULL
,
'media_width'
=>
$media_width_classes
??
NULL
,
'bundle'
=>
$node
->
getType
(),
];
];
return
$banners
;
return
$banners
;
...
...
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