search is ok! (remains to sync search and corpus map

This commit is contained in:
Bachir Soussi Chiadmi
2018-03-19 15:07:19 +01:00
parent 973483a6eb
commit a7f736f919
29 changed files with 656 additions and 147 deletions
@@ -11,10 +11,9 @@ use Drupal\Core\Template\Attribute;
use Drupal\Component\Utility\Unicode;
use Drupal\Core\Render\Element;
// function edlptheme_preprocess_input(&$vars){
function edlptheme_preprocess_page(&$vars){
// dsm($vars, 'vars');
// $vars['attributes']['placeholder'] = "salut";
// }
}
function edlptheme_preprocess_node(&$vars){
$node = $vars['elements']['#node'];
@@ -80,6 +79,30 @@ function edlptheme_preprocess_node__enregistrement__index(&$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')
));
// dpm($vars['link_attributes']);
}
function edlptheme_preprocess_node__enregistrement__player_cartel(&$vars){
// dpm($vars);
// if transcript not empty