Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
uw_fdsu_theme_resp
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_fdsu_theme_resp
Commits
979ff8af
Commit
979ff8af
authored
3 years ago
by
Eric Bremner
Committed by
Eric Bremner
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
ISTWCMS-4704: centralizing preprocess node function for full and teaser nodes
parent
4a5476aa
No related branches found
No related tags found
1 merge request
!34
ISTWCMS-4847: adding preprocess to main content area to add classes for 404...
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
uw_fdsu_theme_resp.theme
+38
-0
38 additions, 0 deletions
uw_fdsu_theme_resp.theme
with
38 additions
and
0 deletions
uw_fdsu_theme_resp.theme
+
38
−
0
View file @
979ff8af
...
...
@@ -330,6 +330,44 @@ function _uw_fdsu_theme_resp_get_image_info(FileFieldItemList $field) {
}
}
/**
* Implements hook_preprocess_node().
*
* Set variables for node and teaser.
*/
function
uw_fdsu_theme_resp_preprocess_node
(
&
$variables
)
{
// The types of nodes the need preprocessing.
$nodes_to_preprocess
=
[
'uw_ct_blog'
,
'uw_ct_event'
,
'uw_ct_news_item'
,
];
// If there is a node that needs preprocessing,
// set the appropriate variables.
if
(
in_array
(
$variables
[
'node'
]
->
getType
(),
$nodes_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'
)
{
$variables
[
'teaser'
]
=
$uwService
->
uwGetNodeContent
(
$variables
[
'node'
],
'teaser'
,
'all'
);
}
// If on a node page get the variables for now.
if
(
$variables
[
'view_mode'
]
==
'full'
)
{
$variables
[
'node_data'
]
=
$uwService
->
uwGetNodeContent
(
$variables
[
'node'
],
'full'
,
'all'
);
$variables
[
'node_data'
][
'content'
]
=
$variables
[
'content'
];
}
// Unset the content variable, so that we do not get
// a second print of all the content.
unset
(
$variables
[
'content'
]);
}
}
/**
* Implements hook_preprocess_block().
*
...
...
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