|
@@ -0,0 +1,105 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+use Drupal\Core\Url;
|
|
|
+
|
|
|
+function template_preprocess_edlp_home(&$vars){
|
|
|
+ $view_builder = \Drupal::entityTypeManager()->getViewBuilder('node');
|
|
|
+ // dpm($vars);
|
|
|
+
|
|
|
+ // render the promoted_nodes
|
|
|
+ foreach($vars['promoted_nodes'] as $node){
|
|
|
+ if($node->hasField('field_view_mode')){
|
|
|
+ switch($node->get('field_view_mode')->value){
|
|
|
+ case "1":
|
|
|
+ $vm = "image_2_columns";
|
|
|
+ break;
|
|
|
+ case "2":
|
|
|
+ $vm = "image_1_columns";
|
|
|
+ break;
|
|
|
+ case "3":
|
|
|
+ $vm = "text_1_column";
|
|
|
+ break;
|
|
|
+ };
|
|
|
+ }else{
|
|
|
+ $vm = 'default';
|
|
|
+ }
|
|
|
+
|
|
|
+ $vars['nodes'][] = array(
|
|
|
+ 'vm'=>$vm,
|
|
|
+ 'build'=>$view_builder->view($node, $vm)
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ // render the presentation column
|
|
|
+ // $vars["presentation"] = array(
|
|
|
+ // "#type"=>"container",
|
|
|
+ // "pres"=>$view_builder->view($vars["presentation_node"], 'default'),
|
|
|
+ // "link"=> array(
|
|
|
+ // '#title' => t('Visiter la collection sonore.'),
|
|
|
+ // '#type' => 'link',
|
|
|
+ // '#url' => Url::fromRoute('<front>', [], array(
|
|
|
+ // 'attributes' => array(
|
|
|
+ // 'class' => ['corpus-link', 'ajax-link']
|
|
|
+ // )
|
|
|
+ // ))
|
|
|
+ // )
|
|
|
+ // );
|
|
|
+
|
|
|
+ // render the last fil column
|
|
|
+ // $vars["last_fil"] = array(
|
|
|
+ // "#type" => "container",
|
|
|
+ // // 'fil' => $view_builder->view($vars['last_fil_node'], 'teaser'),
|
|
|
+ // 'title'=> array("#markup" => "<h2 class='title'>Dernier Fil</h2>"),
|
|
|
+ // 'fil' => $vars['last_fil_node'],
|
|
|
+ // // 'links' => array(
|
|
|
+ // // '#theme' => 'item_list',
|
|
|
+ // // '#items' => array(
|
|
|
+ // // 'link_all' => array(
|
|
|
+ // // '#title' => t("Voir tous les fils de l'EP."),
|
|
|
+ // // '#type' => 'link',
|
|
|
+ // // '#url' => Url::fromRoute('edlp_fils.fils', [], array(
|
|
|
+ // // 'attributes' => array(
|
|
|
+ // // 'class' => ['fils-link', 'ajax-link']
|
|
|
+ // // )
|
|
|
+ // // ))
|
|
|
+ // // ),
|
|
|
+ // // // TODO: link posdcast fils
|
|
|
+ // // 'link_podcast' => array(
|
|
|
+ // // '#title' => t("S'abonner au podcast des fils."),
|
|
|
+ // // '#type' => 'link',
|
|
|
+ // // '#url' => Url::fromRoute('<front>', [], array(
|
|
|
+ // // 'attributes' => array(
|
|
|
+ // // 'class' => ['fils-link']
|
|
|
+ // // )
|
|
|
+ // // ))
|
|
|
+ // // )
|
|
|
+ // // )
|
|
|
+ // // )
|
|
|
+ // );
|
|
|
+
|
|
|
+ // render the last production column
|
|
|
+ // $vars["last_production"] = array(
|
|
|
+ // '#type' => 'container',
|
|
|
+ // 'prod' => $view_builder->view($vars['last_production_node'], 'teaser'),
|
|
|
+ // 'link'=> array(
|
|
|
+ // '#title' => t('Voir toutes les productions.'),
|
|
|
+ // '#type' => 'link',
|
|
|
+ // '#url' => Url::fromRoute('edlp_productions.productions', [], array(
|
|
|
+ // 'attributes' => array(
|
|
|
+ // 'class' => ['productions-link', 'ajax-link']
|
|
|
+ // )
|
|
|
+ // ))
|
|
|
+ // )
|
|
|
+ // );
|
|
|
+
|
|
|
+ // render the next events of agenda as list
|
|
|
+ $agenda = array (
|
|
|
+ '#theme' => 'item_list',
|
|
|
+ '#items' => [],
|
|
|
+ );
|
|
|
+ foreach($vars['agenda_items'] as $node){
|
|
|
+ $agenda['#items'][] = $view_builder->view($node, 'teaser');
|
|
|
+ }
|
|
|
+ $vars['agenda'] = render($agenda);
|
|
|
+
|
|
|
+}
|