123456789101112131415161718192021222324252627282930 |
- <?php
- // use Drupal\Core\Url;
- function template_preprocess_edlp_corpus_docsindex(&$vars){
- // dpm($vars);
- /*
- @see https://www.drupal8.ovh/index.php/en/tutoriels/339/render-a-node-or-an-entity
- */
- $view_builder = \Drupal::entityTypeManager()->getViewBuilder('node');
- if(count($vars['docsindex_nodes'])){
- $docsindex_list = array (
- '#theme' => 'item_list',
- '#items' => [],
- );
- foreach($vars['docsindex_nodes'] as $node){
- $docsindex_list['#items'][] = $view_builder->view($node, 'docsindex');
- }
- $vars['docsindex'] = array(
- "#type"=>"container",
- "#attributes"=>array(
- "class"=>['docsindex']
- ),
- "#markup"=>"<h3>".t("Documents Index")."</h3>",
- "docsindex"=>$docsindex_list
- );
- }
- }
|