Skip to content
Snippets Groups Projects
Commit 1aac98e5 authored by Eric Bremner's avatar Eric Bremner
Browse files

ISTWCMS-4943: adding check to ensure that we get a node object on a revisions page

parent a91dc1e5
No related branches found
No related tags found
1 merge request!40ISTWCMS-4943: adding check to ensure that we get a node object on a revisions page
......@@ -9,6 +9,7 @@ use Drupal\Core\Url;
use Drupal\file\Plugin\Field\FieldType\FileFieldItemList;
use Drupal\image\Plugin\Field\FieldType\ImageItem;
use Drupal\Core\Form\FormStateInterface;
use Drupal\node\Entity\Node;
/**
* @file
......@@ -395,6 +396,14 @@ function uw_fdsu_theme_resp_preprocess_block(&$variables) {
// Load the node.
$node = \Drupal::routeMatch()->getParameter('node');
// ISTWCMS-4943: ensure that we get a node object.
// If node is not object by this point, probably on
// a revision page where node is an integer, so load
// the node.
if (!is_object($node)) {
$node = Node::load($node);
}
// If there is a node, check that it has a featured image.
if ($node) {
......
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