You are here

function template_preprocess_scs_newsletter in Simplenews Content Selection 8

Same name and namespace in other branches
  1. 7.2 scs.theme.inc \template_preprocess_scs_newsletter()

Preprocess for scs_newsletter.

File

./scs.theme.inc, line 56
Theming preprocesses

Code

function template_preprocess_scs_newsletter(&$vars) {

  // Add Table of Contents (if required)
  if ($vars['toc']) {
    $vars['toc'] = theme('scs_toc', array(
      'nodes' => $vars['nodes'],
    ));
  }

  // Render each node using the correct view mode
  foreach ($vars['nodes'] as $nid => $node) {
    $build = \Drupal::entityTypeManager()
      ->getViewBuilder('node')
      ->view($node, $node->scs_view_mode);

    // Strip out contextual links
    unset($build['#contextual_links']['node']);
    $vars['nodes'][$nid] = $build;
  }
}