1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <?php
- // use Drupal\Core\Url;
- function template_preprocess_edlp_agenda(&$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(isset($vars['next_event_node'])){
- // $vars['next_event'] = array(
- // "#markup"=>"<h3>Prochaine Date</h3>",
- // "event"=>$view_builder->view($vars['next_event_node'], 'default')
- // );
- // }
- if(count($vars['coming_events_nodes'])){
- $future_list = array (
- '#theme' => 'item_list',
- '#items' => [],
- );
- foreach($vars['coming_events_nodes'] as $node){
- $future_list['#items'][] = $view_builder->view($node, 'teaser');
- }
- $vars['coming_events'] = array(
- "#type"=>"container",
- "#attributes"=>array(
- "class"=>['future-events']
- ),
- "#markup"=>"<h3>".t("Upcoming Events")."</h3>",
- "future_events"=>$future_list
- );
- }
- $past_list = array (
- '#theme' => 'item_list',
- '#items' => [],
- );
- foreach($vars['past_events_nodes'] as $node){
- $past_list['#items'][] = $view_builder->view($node, 'teaser');
- }
- $vars['past_events'] = array(
- "#type"=>"container",
- "#attributes"=>array(
- "class"=>['past-events']
- ),
- "#markup"=>"<h3>".t("Past Events")."</h3>",
- "past_events"=>$past_list
- );
- // return array(
- // "#type" => "container",
- // "#attributes"=>array(
- // "id"=>['agenda']
- // ),
- // "future_past"=>array(
- // "#type"=>"container",
- // "#attributes"=>array(
- // "class"=>['future-past-events', 'column', 'os-scroll']
- // ),
- // "future"=>,
- // "past"=>
- // )
- // );
- }
|