reinstalled all contribs with composer
need to run : drush ev 'drupal_flush_all_caches();' drush cr and restart nginx and php-fpm before loading the website
This commit is contained in:
@@ -0,0 +1,175 @@
|
||||
<?php
|
||||
|
||||
use Drupal\Core\Url;
|
||||
|
||||
function template_preprocess_edlp_home(&$vars){
|
||||
$node_view_builder = \Drupal::entityTypeManager()->getViewBuilder('node');
|
||||
// $term_view_builder = \Drupal::entityTypeManager()->getViewBuilder('taxonomy_term');
|
||||
// dpm($vars);
|
||||
|
||||
// render the promoted_nodes
|
||||
$vars['nodes'] = array();
|
||||
if(isset($vars['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'=>$node_view_builder->view($node, $vm)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// render the last fil column
|
||||
// $vars["last_fil"] = array(
|
||||
// "#type" => "container",
|
||||
// // 'fil' => $node_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 lasts documents of collection as list
|
||||
if(isset($vars['lastdocs_items'])){
|
||||
$lastdocs_url = Url::fromRoute('edlp_corpus.lastdocs');
|
||||
$lastdocs = array(
|
||||
'#type'=>"container",
|
||||
'title'=>array(
|
||||
'#prefix'=> '<h3>',
|
||||
'#title' => t("Recently uploaded"),
|
||||
'#suffix' => '</h3>',
|
||||
'#type' => 'link',
|
||||
'#url' => $lastdocs_url,
|
||||
'#options'=>array(
|
||||
'attributes' => array(
|
||||
'data-drupal-link-system-path' => $lastdocs_url->getInternalPath(),
|
||||
'class' => array('ajax-link'),
|
||||
)
|
||||
)
|
||||
),
|
||||
'list'=> array(
|
||||
'#theme' => 'item_list',
|
||||
'#items' => [],
|
||||
),
|
||||
'seeall'=>array(
|
||||
'#type' => 'link',
|
||||
'#prefix'=> '<nav>',
|
||||
'#title' => t("See all"),
|
||||
'#suffix'=> '</nav>',
|
||||
'#url' => $lastdocs_url,
|
||||
'#options'=>array(
|
||||
'attributes' => array(
|
||||
'data-drupal-link-system-path' => $lastdocs_url->getInternalPath(),
|
||||
'class' => array('ajax-link'),
|
||||
)
|
||||
)
|
||||
),
|
||||
);
|
||||
foreach($vars['lastdocs_items'] as $node){
|
||||
$lastdocs['list']['#items'][] = $node_view_builder->view($node, 'search_index');
|
||||
}
|
||||
$vars['lastdocs'] = render($lastdocs);
|
||||
}
|
||||
|
||||
// render the next events of agenda as list
|
||||
if(isset($vars['agenda_items'])){
|
||||
$agenda_url = Url::fromRoute('edlp_agenda.agenda');
|
||||
$agenda = array(
|
||||
'#type'=>"container",
|
||||
'title'=>array(
|
||||
'#prefix'=> '<h3>',
|
||||
'#title' => t("Agenda"),
|
||||
'#suffix' => '</h3>',
|
||||
'#type' => 'link',
|
||||
'#url' => $agenda_url,
|
||||
'#options'=>array(
|
||||
'attributes' => array(
|
||||
'data-drupal-link-system-path' => $agenda_url->getInternalPath(),
|
||||
'class' => array('ajax-link'),
|
||||
)
|
||||
)
|
||||
),
|
||||
'list'=> array(
|
||||
'#theme' => 'item_list',
|
||||
'#items' => [],
|
||||
),
|
||||
'seeall'=>array(
|
||||
'#type' => 'link',
|
||||
'#prefix'=> '<nav>',
|
||||
'#title' => t("See all"),
|
||||
'#suffix'=> '</nav>',
|
||||
'#url' => $agenda_url,
|
||||
'#options'=>array(
|
||||
'attributes' => array(
|
||||
'data-drupal-link-system-path' => $agenda_url->getInternalPath(),
|
||||
'class' => array('ajax-link'),
|
||||
)
|
||||
)
|
||||
),
|
||||
);
|
||||
|
||||
foreach($vars['agenda_items'] as $node){
|
||||
$agenda['list']['#items'][] = $node_view_builder->view($node, 'teaser');
|
||||
}
|
||||
$vars['agenda'] = render($agenda);
|
||||
}
|
||||
|
||||
if(isset($vars['collection_link'])){
|
||||
$collection = array(
|
||||
'#type'=>"container",
|
||||
'title'=>array(
|
||||
'#prefix'=> '<h3>',
|
||||
'#title' => t("Collection"),
|
||||
'#suffix' => '</h3>',
|
||||
'#type' => 'link',
|
||||
'#url' => $vars['collection_link']['url'],
|
||||
'#options'=>array(
|
||||
'attributes' => array(
|
||||
'data-drupal-link-system-path' => $vars['collection_link']['internal_path'],
|
||||
'class' => array('ajax-link'),
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
$vars['collection'] = render($collection);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user