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
ac985a98
Commit
ac985a98
authored
3 years ago
by
Eric Bremner
Committed by
Eric Bremner
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
ISTWCMS-4704: adding function to check for featured image
parent
f0d25b76
No related branches found
No related tags found
1 merge request
!112
Feature/istwcms 4704 m26lebla ebremner content types
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/Service/UWService.php
+33
-0
33 additions, 0 deletions
src/Service/UWService.php
src/Service/UWServiceInterface.php
+11
-0
11 additions, 0 deletions
src/Service/UWServiceInterface.php
with
44 additions
and
0 deletions
src/Service/UWService.php
+
33
−
0
View file @
ac985a98
...
...
@@ -370,6 +370,39 @@ class UWService implements UWServiceInterface {
];
}
/**
* {@inheritDoc}
*/
public
function
uwCheckNodeForFeaturedImage
(
Node
$node
):
string
{
// Set the node type.
$node_type
=
$node
->
getType
();
// Get the list of content types that are allowed to have
// feature images from our service.
$featured_image
=
$this
->
uwGetFeaturedImageContentTypes
();
// If node is allowed to have a featured image, make sure that
// node actually has an image.
if
(
in_array
(
$node_type
,
array_keys
(
$featured_image
)))
{
// Get the field name.
$field_name
=
$featured_image
[
$node_type
];
// Get the image object values from the node.
$image
=
$node
->
$field_name
->
getValue
();
// If there is an image present, set the variable so that
// the page title will not be displayed.
if
(
$image
)
{
return
'yes'
;
}
else
{
return
'no'
;
}
}
}
/**
* {@inheritDoc}
*/
...
...
This diff is collapsed.
Click to expand it.
src/Service/UWServiceInterface.php
+
11
−
0
View file @
ac985a98
...
...
@@ -66,6 +66,17 @@ interface UWServiceInterface {
*/
public
function
uwGetFeaturedImageContentTypes
():
array
;
/**
* Gets dates from node.
*
* @param \Drupal\node\Node $node
* Node entity.
*
* @return string
* Yes or no.
*/
public
function
uwCheckNodeForFeaturedImage
(
Node
$node
):
string
;
/**
* Gets dates from node.
*
...
...
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