refactoring and a lot of new design

This commit is contained in:
2017-02-10 18:07:21 +01:00
parent 30577d3c6b
commit 290b8ac157
9 changed files with 696 additions and 186 deletions
@@ -1,8 +1,33 @@
<?php
<?php
//dsm($vars);
// dsm($vars);
$element = $vars['element'];
$vm = $element['#view_mode'];
$ft = $element['#field_type'];
$fn = $element['#field_name'];
$b = $element['#bundle'];
$vars['theme_hook_suggestions'][] = 'field__' . $vars['element']['#view_mode'];
$vars['theme_hook_suggestions'][] = 'field__' . $vars['element']['#field_type'] . '__' . $vars['element']['#view_mode'];
$vars['theme_hook_suggestions'][] = 'field__' . $vars['element']['#field_name'] . '__' . $vars['element']['#view_mode'];
$vars['theme_hook_suggestions'][] = 'field__' . $vm;
$vars['theme_hook_suggestions'][] = 'field__' . $ft . '__' . $vm;
$vars['theme_hook_suggestions'][] = 'field__' . $fn . '__' . $vm;
$vars['theme_hook_suggestions'][] = 'field__' . $fn . '__' . $vm;
$vars['theme_hook_suggestions'][] = 'field__' . $b . '__' . $fn . '__' . $vm;
if($fn == 'body' && $vm == 'accueil' && $b == 'thematique'){
$vars['items'][0] = array(
'summary' =>array(
"#type"=>"markup",
"#markup"=>$element['#items'][0]['safe_summary'],
"#prefix"=>"<div class='summary'>",
"#suffix"=>"</div>",
),
'value' =>array(
"#type"=>"markup",
"#markup"=>$element['#items'][0]['safe_value'],
"#prefix"=>"<div class='value'>",
"#suffix"=>"</div>",
)
);
}
@@ -1,7 +1,25 @@
<?php
<?php
// dsm($vars);
$node = $vars['node'];
//dsm($vars);
$vars['theme_hook_suggestions'][] = 'node__'.$vars['view_mode'];
$vars['theme_hook_suggestions'][] = 'node__' . $vars['type'] . '__' . $vars['view_mode'];
$vars['print_title'] = true;
$alias = drupal_get_path_alias('node/'.$vars['node']->nid);
if($node->type == "thematique"){
$vars['id'] = $alias;
}else{
$vars["classes_array"][] = $alias;
$vars['id'] = "node-".$node->nid;
if($vars['view_mode'] == "accueil"){
$vars['print_title'] = false;
}
}
$vars["classes_array"][] = "node-".$node->nid;
@@ -2,10 +2,10 @@
// dsm($vars, 'vars');
$display = $vars['display'];
$node_ctx = $display->context['requiredcontext_entity:node_1'];
// $display = $vars['display'];
// $node_ctx = $display->context['requiredcontext_entity:node_1'];
// dsm($node_ctx, 'node_ctx');
// change css id with node alias to be able to link it with anchors on top menu
$vars['css_id'] = drupal_get_path_alias('node/'.$node_ctx->data->nid);
// $vars['css_id'] = drupal_get_path_alias('node/'.$node_ctx->data->nid);
// dsm($vars['css_id'], 'css_id');