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
452a3b4d
Commit
452a3b4d
authored
3 years ago
by
Eric Bremner
Committed by
Eric Bremner
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
ISTWCMS-4704: adding logic for featured images on nodes
parent
57edf56d
No related branches found
Branches containing commit
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
+18
-2
18 additions, 2 deletions
src/Service/UWService.php
src/Service/UWServiceInterface.php
+8
-0
8 additions, 0 deletions
src/Service/UWServiceInterface.php
with
26 additions
and
2 deletions
src/Service/UWService.php
+
18
−
2
View file @
452a3b4d
...
@@ -114,6 +114,8 @@ class UWService implements UWServiceInterface {
...
@@ -114,6 +114,8 @@ class UWService implements UWServiceInterface {
$get_content
=
FALSE
;
$get_content
=
FALSE
;
$get_title
=
TRUE
;
$get_title
=
TRUE
;
$featured_image
=
$this
->
uwGetFeaturedImageContentTypes
();
// Setup flags based on teaser content argument.
// Setup flags based on teaser content argument.
if
(
$content
==
'all'
)
{
if
(
$content
==
'all'
)
{
$get_header
=
TRUE
;
$get_header
=
TRUE
;
...
@@ -126,7 +128,10 @@ class UWService implements UWServiceInterface {
...
@@ -126,7 +128,10 @@ class UWService implements UWServiceInterface {
if
(
$view_mode
==
'full'
)
{
if
(
$view_mode
==
'full'
)
{
$get_title
=
FALSE
;
$get_title
=
FALSE
;
$get_image
=
TRUE
;
if
(
in_array
(
$node
->
getType
(),
array_keys
(
$featured_image
)))
{
$get_image
=
TRUE
;
}
}
}
}
}
else
{
else
{
...
@@ -222,7 +227,7 @@ class UWService implements UWServiceInterface {
...
@@ -222,7 +227,7 @@ class UWService implements UWServiceInterface {
'title'
=>
$get_title
?
TRUE
:
NULL
,
'title'
=>
$get_title
?
TRUE
:
NULL
,
'sub_title'
=>
$get_header
?
'field_uw_ct_contact_title'
:
NULL
,
'sub_title'
=>
$get_header
?
'field_uw_ct_contact_title'
:
NULL
,
'affiliation'
=>
$get_header
?
'field_uw_ct_contact_affiliation'
:
NULL
,
'affiliation'
=>
$get_header
?
'field_uw_ct_contact_affiliation'
:
NULL
,
'image'
=>
$get_
header
?
'field_uw_ct_contact_image'
:
NULL
,
'image'
=>
$get_
image
?
'field_uw_ct_contact_image'
:
NULL
,
'content'
=>
$get_content
?
'layout_builder__layout'
:
NULL
,
'content'
=>
$get_content
?
'layout_builder__layout'
:
NULL
,
'email'
=>
$get_footer
?
'field_uw_ct_contact_email'
:
NULL
,
'email'
=>
$get_footer
?
'field_uw_ct_contact_email'
:
NULL
,
'location'
=>
$get_footer
?
'field_uw_ct_contact_location'
:
NULL
,
'location'
=>
$get_footer
?
'field_uw_ct_contact_location'
:
NULL
,
...
@@ -353,6 +358,17 @@ class UWService implements UWServiceInterface {
...
@@ -353,6 +358,17 @@ class UWService implements UWServiceInterface {
return
$node_data
;
return
$node_data
;
}
}
/**
* {@inheritDoc}
*/
public
function
uwGetFeaturedImageContentTypes
():
array
{
return
[
'uw_ct_blog'
=>
'field_uw_blog_listing_page_image'
,
'uw_ct_event'
=>
'field_uw_event_listing_page_img'
,
'uw_ct_news_item'
=>
'field_uw_news_listing_page_image'
,
];
}
/**
/**
* {@inheritDoc}
* {@inheritDoc}
*/
*/
...
...
This diff is collapsed.
Click to expand it.
src/Service/UWServiceInterface.php
+
8
−
0
View file @
452a3b4d
...
@@ -58,6 +58,14 @@ interface UWServiceInterface {
...
@@ -58,6 +58,14 @@ interface UWServiceInterface {
*/
*/
public
function
uwGetNodeData
(
Node
$node
,
string
$view_mode
,
array
$content_data
):
array
;
public
function
uwGetNodeData
(
Node
$node
,
string
$view_mode
,
array
$content_data
):
array
;
/**
* Gets content types that have feature images.
*
* @return array
* Array of content types that has featured images.
*/
public
function
uwGetFeaturedImageContentTypes
():
array
;
/**
/**
* Gets dates from node.
* 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