Skip to content
Snippets Groups Projects

Feature/istwcms 4619 ebremner variables for listing page

1 file
+ 23
0
Compare changes
  • Side-by-side
  • Inline
+ 23
0
@@ -22,3 +22,26 @@ function uw_ct_news_item_preprocess_block($variables) {
unset($variables['content']['#view']->exposed_widgets);
}
}
/**
* Implements hook_preprocess_node().
*
* Set variables for node teaser.
*/
function uw_ct_news_item_preprocess_node(&$variables) {
// If we are on a news node that is a teaser,
// get out the variables to be used in pattern-lab.
if ($variables['node']->getType() == 'uw_ct_news_item' && $variables['view_mode'] == 'teaser') {
// The UW service object.
$uwService = \Drupal::service('uw_cfg_common.uw_service');
// Get the teaser variables.
$variables['teaser'] = $uwService->uwGetNodeContent($variables['node'], 'teaser', 'all');
// Unset the content variable, so that we do not get
// a second print of all the content.
unset($variables['content']);
}
}
Loading