Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
WCMS
uw_fdsu_theme_resp
Commits
e19863b2
Commit
e19863b2
authored
Nov 17, 2021
by
Igor Biki
Browse files
Merge branch 'feature/ISTWCMS-5195-ebremner-node-theming' into '1.0.x'
Feature/istwcms 5195 ebremner node theming See merge request
!56
parents
02456945
23ba22da
Changes
4
Show whitespace changes
Inline
Side-by-side
templates/container/container.html.twig
View file @
e19863b2
...
...
@@ -30,6 +30,7 @@
<div
class=
"node--type-
{{
node_type
}}
"
>
{%
include
'@components/card/card--node/card--node.twig'
with
{
'node'
:
header_data
,
'type'
:
'node'
,
'featured_image'
:
featured_image
,
}
%}
</div>
...
...
@@ -41,7 +42,7 @@
<div
class=
"layout uw-contained-width"
>
{%
include
'@components/card/card--node/card--node.twig'
with
{
'node'
:
footer_data
,
'type'
:
'
footer
'
,
'type'
:
'
node
'
,
}
%}
</div>
{%
endif
%}
templates/node/node--teaser.html.twig
View file @
e19863b2
{%
include
'@components/card/card--teaser/card--teaser.twig'
with
{
'teaser'
:
teaser
,
'type'
:
'teaser'
}
%}
templates/node/node.html.twig
View file @
e19863b2
...
...
@@ -96,7 +96,7 @@
<div
{{
content_attributes.addClass
(
'node__content'
)
}}
>
{%
include
'@components/card/card--node/card--node.twig'
with
{
'node'
:
node_data
,
'
featured_image'
:
featured_image
,
'
type'
:
'node'
}
%}
</div>
{%
endblock
%}
...
...
uw_fdsu_theme_resp.theme
View file @
e19863b2
...
...
@@ -350,6 +350,8 @@ function uw_fdsu_theme_resp_preprocess_node(&$variables) {
// The UW service object.
$uwService
=
\
Drupal
::
service
(
'uw_cfg_common.uw_service'
);
$nodeContent
=
\
Drupal
::
service
(
'uw_cfg_common.uw_node_content'
);
// The types of nodes the need preprocessing.
$nodes_to_preprocess
=
$uwService
->
uwGetNodePreprocessing
(
'full'
);
...
...
@@ -361,21 +363,18 @@ function uw_fdsu_theme_resp_preprocess_node(&$variables) {
if
(
in_array
(
$variables
[
'node'
]
->
getType
(),
$nodes_to_preprocess
)
||
in_array
(
$variables
[
'node'
]
->
getType
(),
$teasers_to_preprocess
))
{
// The UW service object.
$uwService
=
\
Drupal
::
service
(
'uw_cfg_common.uw_service'
);
// If on a teaser page get the variables for teaser.
if
(
$variables
[
'view_mode'
]
==
'teaser'
&&
in_array
(
$variables
[
'node'
]
->
getType
(),
$teasers_to_preprocess
))
{
$variables
[
'teaser'
]
=
$
uwService
->
uwG
etNodeContent
(
$variables
[
'node'
],
'teaser'
,
'all'
);
$variables
[
'teaser'
]
=
$
nodeContent
->
g
etNodeContent
(
$variables
[
'node'
],
'teaser'
,
'all'
);
}
// If on a node page get the variables for now.
if
(
$variables
[
'view_mode'
]
==
'full'
&&
in_array
(
$variables
[
'node'
]
->
getType
(),
$nodes_to_preprocess
))
{
$variables
[
'node_data'
]
=
$uwService
->
uwGetNodeContent
(
$variables
[
'node'
],
'full'
,
'all'
);
in_array
(
$variables
[
'node'
]
->
getType
(),
$nodes_to_preprocess
))
{
$variables
[
'node_data'
]
=
$nodeContent
->
getNodeContent
(
$variables
[
'node'
],
'full'
,
'all'
);
$variables
[
'node_data'
][
'content'
]
=
$variables
[
'content'
];
$variables
[
'featured_image'
]
=
$uwService
->
uwCheckNodeForFeaturedImage
(
$variables
[
'node'
]);
}
// Unset the content variable, so that we do not get
...
...
@@ -489,6 +488,9 @@ function uw_fdsu_theme_resp_preprocess_container(&$variables) {
// The UW service object.
$uwService
=
\
Drupal
::
service
(
'uw_cfg_common.uw_service'
);
// The UW node content service.
$uwNodeContent
=
\
Drupal
::
service
(
'uw_cfg_common.uw_node_content'
);
// The list of content types that will have header
// and footer in layout builder pages.
$content_types
=
$uwService
->
uwGetNodePreprocessing
(
'layout_container'
);
...
...
@@ -510,8 +512,8 @@ function uw_fdsu_theme_resp_preprocess_container(&$variables) {
// If there is a node object, get the header and footer data.
if
(
$node
)
{
$variables
[
'header_data'
]
=
$uw
Service
->
uwG
etNodeContent
(
$node
,
'teaser'
,
'header'
);
$variables
[
'footer_data'
]
=
$uw
Service
->
uwG
etNodeContent
(
$node
,
'teaser'
,
'footer'
);
$variables
[
'header_data'
]
=
$uw
NodeContent
->
g
etNodeContent
(
$node
,
'teaser'
,
'header'
);
$variables
[
'footer_data'
]
=
$uw
NodeContent
->
g
etNodeContent
(
$node
,
'teaser'
,
'footer'
);
}
}
}
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment