big refactoring of mobile version xhich has now a hamburger menu and a link to collection

This commit is contained in:
2018-11-21 12:51:24 +01:00
parent c92c348eee
commit e204a08202
18 changed files with 668 additions and 389 deletions
+133 -79
View File
@@ -128,98 +128,128 @@ function edlptheme_preprocess_edlp_productions(&$vars){
}
function edlptheme_preprocess_node__enregistrement__index(&$vars){
$node = $vars['elements']['#node'];
$options = ['absolute' => TRUE];
$url = Url::fromRoute('entity.node.canonical', ['node' => $node->id()], $options);
$system_path = $url->getInternalPath();
// get the audio file url
$field_son_values = $node->get('field_son')->getValue();
$son_fid = count($field_son_values) ? $field_son_values[0]['target_id'] : "";
$son_file = \Drupal\file\Entity\File::load($son_fid);
$son_url = null;
if($son_file){
$son_uri = $son_file->getFileUri();
$son_url = file_create_url($son_uri);
}
// $node = $vars['elements']['#node'];
// $options = ['absolute' => TRUE];
// $url = Url::fromRoute('entity.node.canonical', ['node' => $node->id()], $options);
// $system_path = $url->getInternalPath();
// // get the audio file url
// $field_son_values = $node->get('field_son')->getValue();
// $son_fid = count($field_son_values) ? $field_son_values[0]['target_id'] : "";
// $son_file = \Drupal\file\Entity\File::load($son_fid);
// $son_url = null;
// if($son_file){
// $son_uri = $son_file->getFileUri();
// $son_url = file_create_url($son_uri);
// }
//
// $vars['link_attributes'] = new Attribute(array(
// 'data-drupal-link-system-path' => $system_path=='' ? '<front>' : $system_path,
// 'audio_url' => $son_url,
// 'nid' => $node->id(),
// 'class' => array('audio-link', 'ajax-link')
// ));
edlptheme_prepare_audio_link($vars);
// dpm($vars['link_attributes']);
}
$vars['link_attributes'] = new Attribute(array(
'data-drupal-link-system-path' => $system_path=='' ? '<front>' : $system_path,
'audio_url' => $son_url,
'nid' => $node->id(),
'class' => array('audio-link', 'ajax-link')
));
// forhome mobile index
function edlptheme_preprocess_node__enregistrement__index_home(&$vars){
// $node = $vars['elements']['#node'];
// $options = ['absolute' => TRUE];
// $url = Url::fromRoute('entity.node.canonical', ['node' => $node->id()], $options);
// $system_path = $url->getInternalPath();
// // get the audio file url
// $field_son_values = $node->get('field_son')->getValue();
// $son_fid = count($field_son_values) ? $field_son_values[0]['target_id'] : "";
// $son_file = \Drupal\file\Entity\File::load($son_fid);
// $son_url = null;
// if($son_file){
// $son_uri = $son_file->getFileUri();
// $son_url = file_create_url($son_uri);
// }
//
// $vars['link_attributes'] = new Attribute(array(
// 'data-drupal-link-system-path' => $system_path=='' ? '<front>' : $system_path,
// 'audio_url' => $son_url,
// 'nid' => $node->id(),
// 'class' => array('audio-link', 'ajax-link')
// ));
edlptheme_prepare_audio_link($vars);
// dpm($vars['link_attributes']);
}
function edlptheme_preprocess_node__enregistrement__search_index(&$vars){
$node = $vars['elements']['#node'];
$options = ['absolute' => TRUE];
$url = Url::fromRoute('entity.node.canonical', ['node' => $node->id()], $options);
$system_path = $url->getInternalPath();
// get the audio file url
$field_son_values = $node->get('field_son')->getValue();
$son_fid = count($field_son_values) ? $field_son_values[0]['target_id'] : "";
$son_file = \Drupal\file\Entity\File::load($son_fid);
$son_url = null;
if($son_file){
$son_uri = $son_file->getFileUri();
$son_url = file_create_url($son_uri);
}
$vars['link_attributes'] = new Attribute(array(
'data-drupal-link-system-path' => $system_path=='' ? '<front>' : $system_path,
'audio_url' => $son_url,
'nid' => $node->id(),
'class' => array('audio-link', 'ajax-link')
));
// $node = $vars['elements']['#node'];
// $options = ['absolute' => TRUE];
// $url = Url::fromRoute('entity.node.canonical', ['node' => $node->id()], $options);
// $system_path = $url->getInternalPath();
// // get the audio file url
// $field_son_values = $node->get('field_son')->getValue();
// $son_fid = count($field_son_values) ? $field_son_values[0]['target_id'] : "";
// $son_file = \Drupal\file\Entity\File::load($son_fid);
// $son_url = null;
// if($son_file){
// $son_uri = $son_file->getFileUri();
// $son_url = file_create_url($son_uri);
// }
//
// $vars['link_attributes'] = new Attribute(array(
// 'data-drupal-link-system-path' => $system_path=='' ? '<front>' : $system_path,
// 'audio_url' => $son_url,
// 'nid' => $node->id(),
// 'class' => array('audio-link', 'ajax-link')
// ));
edlptheme_prepare_audio_link($vars);
// dpm($vars['link_attributes']);
}
function edlptheme_preprocess_node__enregistrement__lastdocs(&$vars){
$node = $vars['elements']['#node'];
$options = ['absolute' => TRUE];
$url = Url::fromRoute('entity.node.canonical', ['node' => $node->id()], $options);
$system_path = $url->getInternalPath();
// get the audio file url
$field_son_values = $node->get('field_son')->getValue();
$son_fid = count($field_son_values) ? $field_son_values[0]['target_id'] : "";
$son_file = \Drupal\file\Entity\File::load($son_fid);
$son_url = null;
if($son_file){
$son_uri = $son_file->getFileUri();
$son_url = file_create_url($son_uri);
}
$vars['link_attributes'] = new Attribute(array(
'data-drupal-link-system-path' => $system_path=='' ? '<front>' : $system_path,
'audio_url' => $son_url,
'nid' => $node->id(),
'class' => array('audio-link', 'ajax-link')
));
// $node = $vars['elements']['#node'];
// $options = ['absolute' => TRUE];
// $url = Url::fromRoute('entity.node.canonical', ['node' => $node->id()], $options);
// $system_path = $url->getInternalPath();
// // get the audio file url
// $field_son_values = $node->get('field_son')->getValue();
// $son_fid = count($field_son_values) ? $field_son_values[0]['target_id'] : "";
// $son_file = \Drupal\file\Entity\File::load($son_fid);
// $son_url = null;
// if($son_file){
// $son_uri = $son_file->getFileUri();
// $son_url = file_create_url($son_uri);
// }
//
// $vars['link_attributes'] = new Attribute(array(
// 'data-drupal-link-system-path' => $system_path=='' ? '<front>' : $system_path,
// 'audio_url' => $son_url,
// 'nid' => $node->id(),
// 'class' => array('audio-link', 'ajax-link')
// ));
edlptheme_prepare_audio_link($vars);
// dpm($vars['link_attributes']);
}
function edlptheme_preprocess_node__enregistrement__compo(&$vars){
$node = $vars['elements']['#node'];
$options = ['absolute' => TRUE];
$url = Url::fromRoute('entity.node.canonical', ['node' => $node->id()], $options);
$system_path = $url->getInternalPath();
// get the audio file url
$field_son_values = $node->get('field_son')->getValue();
$son_fid = count($field_son_values) ? $field_son_values[0]['target_id'] : "";
$son_file = \Drupal\file\Entity\File::load($son_fid);
$son_url = null;
if($son_file){
$son_uri = $son_file->getFileUri();
$son_url = file_create_url($son_uri);
}
$vars['link_attributes'] = new Attribute(array(
'data-drupal-link-system-path' => $system_path=='' ? '<front>' : $system_path,
'audio_url' => $son_url,
'nid' => $node->id(),
'class' => array('audio-link', 'ajax-link')
));
// $node = $vars['elements']['#node'];
// $options = ['absolute' => TRUE];
// $url = Url::fromRoute('entity.node.canonical', ['node' => $node->id()], $options);
// $system_path = $url->getInternalPath();
// // get the audio file url
// $field_son_values = $node->get('field_son')->getValue();
// $son_fid = count($field_son_values) ? $field_son_values[0]['target_id'] : "";
// $son_file = \Drupal\file\Entity\File::load($son_fid);
// $son_url = null;
// if($son_file){
// $son_uri = $son_file->getFileUri();
// $son_url = file_create_url($son_uri);
// }
//
// $vars['link_attributes'] = new Attribute(array(
// 'data-drupal-link-system-path' => $system_path=='' ? '<front>' : $system_path,
// 'audio_url' => $son_url,
// 'nid' => $node->id(),
// 'class' => array('audio-link', 'ajax-link')
// ));
edlptheme_prepare_audio_link($vars);
// dpm($vars);
$title = $vars['label'][0]['#context']['value'];
@@ -227,6 +257,30 @@ function edlptheme_preprocess_node__enregistrement__compo(&$vars){
// dpm($vars['link_attributes']);
}
function edlptheme_prepare_audio_link(&$vars){
$node = $vars['elements']['#node'];
$options = ['absolute' => TRUE];
$url = Url::fromRoute('entity.node.canonical', ['node' => $node->id()], $options);
$system_path = $url->getInternalPath();
// get the audio file url
$field_son_values = $node->get('field_son')->getValue();
$son_fid = count($field_son_values) ? $field_son_values[0]['target_id'] : "";
$son_file = \Drupal\file\Entity\File::load($son_fid);
$son_url = null;
if($son_file){
$son_uri = $son_file->getFileUri();
$son_url = file_create_url($son_uri);
}
$vars['link_attributes'] = new Attribute(array(
'data-drupal-link-system-path' => $system_path=='' ? '<front>' : $system_path,
'audio_url' => $son_url,
'nid' => $node->id(),
'class' => array('audio-link', 'ajax-link')
));
}
function edlptheme_preprocess_node__enregistrement__player_cartel(&$vars){
// dpm($vars);
$node = $vars['node'];