Skip to content
Snippets Groups Projects
Commit 6f3cefed authored by Eric Bremner's avatar Eric Bremner Committed by Eric Bremner
Browse files

ISTWCMS-4704: updating a lot of things to use featured image

parent 17a39317
No related branches found
No related tags found
1 merge request!34ISTWCMS-4847: adding preprocess to main content area to add classes for 404...
...@@ -27,10 +27,10 @@ ...@@ -27,10 +27,10 @@
%} %}
{% if header_data %} {% if header_data %}
<div class="layout uw-contained-width"> <div class="node--type-{{ node_type }}">
{% include '@components/card/card--teaser/card--teaser.twig' with { {% include '@components/card/card--node/card--node.twig' with {
'teaser': header_data, 'node': header_data,
'type': 'header', 'featured_image': featured_image,
} %} } %}
</div> </div>
{% endif %} {% endif %}
......
...@@ -87,14 +87,6 @@ ...@@ -87,14 +87,6 @@
{{ attach_library('seven/classy.node') }} {{ attach_library('seven/classy.node') }}
{% if view_mode == 'full' %}
{% if node_data.sources %}
{% set featured_image = 'yes' %}
{% else %}
{% set featured_image = 'no' %}
{% endif %}
{% endif %}
{% embed '@layouts/node/node.twig' with { {% embed '@layouts/node/node.twig' with {
'classes': classes, 'classes': classes,
'has_sidebar': sidebar ? 'Yes' : 'No' 'has_sidebar': sidebar ? 'Yes' : 'No'
......
...@@ -378,6 +378,7 @@ function uw_fdsu_theme_resp_preprocess_node(&$variables) { ...@@ -378,6 +378,7 @@ function uw_fdsu_theme_resp_preprocess_node(&$variables) {
in_array($variables['node']->getType(), $nodes_to_preprocess)) { in_array($variables['node']->getType(), $nodes_to_preprocess)) {
$variables['node_data'] = $uwService->uwGetNodeContent($variables['node'], 'full', 'all'); $variables['node_data'] = $uwService->uwGetNodeContent($variables['node'], 'full', 'all');
$variables['node_data']['content'] = $variables['content']; $variables['node_data']['content'] = $variables['content'];
$variables['featured_image'] = $uwService->uwCheckNodeForFeaturedImage($variables['node']);
} }
// Unset the content variable, so that we do not get // Unset the content variable, so that we do not get
...@@ -410,29 +411,7 @@ function uw_fdsu_theme_resp_preprocess_block(&$variables) { ...@@ -410,29 +411,7 @@ function uw_fdsu_theme_resp_preprocess_block(&$variables) {
// The UW service object. // The UW service object.
$uwService = \Drupal::service('uw_cfg_common.uw_service'); $uwService = \Drupal::service('uw_cfg_common.uw_service');
// Set the node type. $variables['featured_image'] = $uwService->uwCheckNodeForFeaturedImage($node);
$node_type = $node->getType();
// Get the list of content types that are allowed to have
// feature images from our service.
$featured_image = $uwService->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) {
$variables['featured_image'] = TRUE;
}
}
} }
} }
...@@ -526,6 +505,10 @@ function uw_fdsu_theme_resp_preprocess_container(&$variables) { ...@@ -526,6 +505,10 @@ function uw_fdsu_theme_resp_preprocess_container(&$variables) {
// Get the node object. // Get the node object.
$node = \Drupal::routeMatch()->getParameter('node'); $node = \Drupal::routeMatch()->getParameter('node');
// Set variables for featured image.
$variables['node_type'] = str_replace('_', '-', $node->getType());
$variables['featured_image'] = $uwService->uwCheckNodeForFeaturedImage($node);
// If there is a node object, get the header and footer data. // If there is a node object, get the header and footer data.
if ($node) { if ($node) {
$variables['header_data'] = $uwService->uwGetNodeContent($node, 'teaser', 'header'); $variables['header_data'] = $uwService->uwGetNodeContent($node, 'teaser', 'header');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment