fixed collection access on mobile
This commit is contained in:
@@ -8,27 +8,30 @@ function template_preprocess_edlp_home(&$vars){
|
||||
// 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();
|
||||
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)
|
||||
);
|
||||
$vars['nodes'][] = array(
|
||||
'vm'=>$vm,
|
||||
'build'=>$node_view_builder->view($node, $vm)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// render the presentation column
|
||||
@@ -95,66 +98,74 @@ function template_preprocess_edlp_home(&$vars){
|
||||
|
||||
|
||||
// render the lasts documents of collection as list
|
||||
$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'),
|
||||
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' => [],
|
||||
),
|
||||
);
|
||||
foreach($vars['lastdocs_items'] as $node){
|
||||
$lastdocs['list']['#items'][] = $node_view_builder->view($node, 'search_index');
|
||||
),
|
||||
'list'=> array(
|
||||
'#theme' => 'item_list',
|
||||
'#items' => [],
|
||||
),
|
||||
);
|
||||
foreach($vars['lastdocs_items'] as $node){
|
||||
$lastdocs['list']['#items'][] = $node_view_builder->view($node, 'search_index');
|
||||
}
|
||||
$vars['lastdocs'] = render($lastdocs);
|
||||
}
|
||||
$vars['lastdocs'] = render($lastdocs);
|
||||
|
||||
// render the next events of agenda as list
|
||||
$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'),
|
||||
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' => [],
|
||||
),
|
||||
);
|
||||
),
|
||||
'list'=> array(
|
||||
'#theme' => 'item_list',
|
||||
'#items' => [],
|
||||
),
|
||||
);
|
||||
|
||||
foreach($vars['agenda_items'] as $node){
|
||||
$agenda['list']['#items'][] = $node_view_builder->view($node, 'teaser');
|
||||
foreach($vars['agenda_items'] as $node){
|
||||
$agenda['list']['#items'][] = $node_view_builder->view($node, 'teaser');
|
||||
}
|
||||
$vars['agenda'] = render($agenda);
|
||||
}
|
||||
$vars['agenda'] = render($agenda);
|
||||
|
||||
if(isset($vars['entrees_items'])){
|
||||
$entrees = array(
|
||||
'#type'=>"container",
|
||||
// 'title'=>array(
|
||||
// '#markup'=>"<h3>".t("Entries")."</h3>",
|
||||
// '#attributes' => array(
|
||||
// 'id' => array('collection'),
|
||||
// ),
|
||||
'#prefix' => '<div id="collection"></div>',
|
||||
'title'=>array(
|
||||
'#markup'=>"<h3>".t("Collection")."</h3>",
|
||||
),
|
||||
'list'=> array(
|
||||
'#theme' => 'item_list',
|
||||
'#items' => [],
|
||||
|
||||
Reference in New Issue
Block a user