fixed collection access on mobile

This commit is contained in:
2018-11-20 15:16:26 +01:00
parent 784d7c6b0f
commit 8f674817e0
18 changed files with 601 additions and 286 deletions
@@ -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' => [],
@@ -1,13 +1,20 @@
{# presentation #}
{# last_fil #}
{# last_production #}
{% for node in nodes %}
{% if nodes %}
{% for node in nodes %}
{{ node.build }}
{% endfor %}
{% endfor %}
{% endif %}
{{ lastdocs }}
{% if lastdocs %}
{{ lastdocs }}
{% endif %}
{{ agenda }}
{% if agenda %}
{{ agenda }}
{% endif %}
{% if entrees %}
{{ entrees }}