index general, fixe #541
This commit is contained in:
@@ -6,6 +6,8 @@ dependencies:
|
||||
- field.field.node.enregistrement.body
|
||||
- field.field.node.enregistrement.field_collectionneurs
|
||||
- field.field.node.enregistrement.field_description
|
||||
- field.field.node.enregistrement.field_domain_access
|
||||
- field.field.node.enregistrement.field_domain_all_affiliates
|
||||
- field.field.node.enregistrement.field_entrees
|
||||
- field.field.node.enregistrement.field_genres
|
||||
- field.field.node.enregistrement.field_langues
|
||||
@@ -59,11 +61,25 @@ content:
|
||||
audio_player_autoplay: 0
|
||||
download_button: 0
|
||||
download_link: 0
|
||||
audio_player_wavesurfer_audiorate: 1
|
||||
audio_player_wavesurfer_autocenter: true
|
||||
audio_player_wavesurfer_bargap: 0
|
||||
audio_player_wavesurfer_barheight: 1
|
||||
audio_player_wavesurfer_barwidth: null
|
||||
audio_player_wavesurfer_cursorcolor: '#333'
|
||||
audio_player_wavesurfer_cursorwidth: 1
|
||||
audio_player_wavesurfer_forcedecode: false
|
||||
audio_player_wavesurfer_normalize: false
|
||||
audio_player_wavesurfer_progresscolor: '#555'
|
||||
audio_player_wavesurfer_responsive: false
|
||||
audio_player_wavesurfer_wavecolor: '#999'
|
||||
third_party_settings: { }
|
||||
hidden:
|
||||
body: true
|
||||
chutier_actions: true
|
||||
field_collectionneurs: true
|
||||
field_domain_access: true
|
||||
field_domain_all_affiliates: true
|
||||
field_entrees: true
|
||||
field_genres: true
|
||||
field_langues: true
|
||||
@@ -75,3 +91,4 @@ hidden:
|
||||
langcode: true
|
||||
links: true
|
||||
relations: true
|
||||
search_api_excerpt: true
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
uuid: 69543cf8-6951-47c3-a811-c3c7d5e1a711
|
||||
langcode: fr
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- core.entity_view_mode.node.docsindex
|
||||
- field.field.node.enregistrement.body
|
||||
- field.field.node.enregistrement.field_collectionneurs
|
||||
- field.field.node.enregistrement.field_description
|
||||
- field.field.node.enregistrement.field_domain_access
|
||||
- field.field.node.enregistrement.field_domain_all_affiliates
|
||||
- field.field.node.enregistrement.field_entrees
|
||||
- field.field.node.enregistrement.field_genres
|
||||
- field.field.node.enregistrement.field_langues
|
||||
- field.field.node.enregistrement.field_locuteurs
|
||||
- field.field.node.enregistrement.field_nbr_locuteurs
|
||||
- field.field.node.enregistrement.field_son
|
||||
- field.field.node.enregistrement.field_transcript_trad
|
||||
- field.field.node.enregistrement.field_transcript_vo
|
||||
- field.field.node.enregistrement.field_workflow
|
||||
- node.type.enregistrement
|
||||
module:
|
||||
- text
|
||||
- user
|
||||
id: node.enregistrement.docsindex
|
||||
targetEntityType: node
|
||||
bundle: enregistrement
|
||||
mode: docsindex
|
||||
content:
|
||||
content_moderation_control:
|
||||
weight: -20
|
||||
region: content
|
||||
settings: { }
|
||||
third_party_settings: { }
|
||||
field_description:
|
||||
weight: 1
|
||||
label: hidden
|
||||
settings: { }
|
||||
third_party_settings: { }
|
||||
type: text_default
|
||||
region: content
|
||||
field_entrees:
|
||||
type: entity_reference_label
|
||||
weight: 0
|
||||
region: content
|
||||
label: hidden
|
||||
settings:
|
||||
link: false
|
||||
third_party_settings: { }
|
||||
hidden:
|
||||
addtoany: true
|
||||
body: true
|
||||
chutier_actions: true
|
||||
field_collectionneurs: true
|
||||
field_domain_access: true
|
||||
field_domain_all_affiliates: true
|
||||
field_genres: true
|
||||
field_langues: true
|
||||
field_locuteurs: true
|
||||
field_nbr_locuteurs: true
|
||||
field_son: true
|
||||
field_transcript_trad: true
|
||||
field_transcript_vo: true
|
||||
field_workflow: true
|
||||
langcode: true
|
||||
links: true
|
||||
relations: true
|
||||
search_api_excerpt: true
|
||||
@@ -0,0 +1,10 @@
|
||||
uuid: e08c4592-af43-4ddb-9a18-e56830765372
|
||||
langcode: fr
|
||||
status: true
|
||||
dependencies:
|
||||
module:
|
||||
- node
|
||||
id: node.docsindex
|
||||
label: DocsIndex
|
||||
targetEntityType: node
|
||||
cache: true
|
||||
@@ -55,6 +55,7 @@ function edlp_ajax_page_attachments(array &$attachments) {
|
||||
|| preg_match('/^\/?agenda/', $current_path)
|
||||
|| preg_match('/^\/?studio/', $current_path)
|
||||
|| preg_match('/^\/?search/', $current_path)
|
||||
|| preg_match('/^\/?docsindex/', $current_path)
|
||||
|| preg_match('/^\/?lastdocs/', $current_path)
|
||||
|| preg_match('/^\/?articles/', $current_path)){
|
||||
$redirect = true;
|
||||
|
||||
@@ -25,9 +25,17 @@ function edlp_corpus_theme($existing, $type, $theme, $path) {
|
||||
// 'render element' => '',
|
||||
'file' => 'includes/blockentrees.inc',
|
||||
'variables' => array(
|
||||
'docsindex_link' => null,
|
||||
'entrees_items' => array(),
|
||||
),
|
||||
),
|
||||
'edlp_corpus_docsindex' => array(
|
||||
// 'render element' => '',
|
||||
'file' => 'includes/edlp_corpus_docsindex.inc',
|
||||
'variables' => array(
|
||||
'docsindex_nodes' => NULL,
|
||||
),
|
||||
),
|
||||
'edlp_corpus_lastdocs' => array(
|
||||
// 'render element' => '',
|
||||
'file' => 'includes/edlp_corpus_lastdocs.inc',
|
||||
|
||||
@@ -15,6 +15,23 @@ edlp_corpus.corpusjson:
|
||||
_permission: 'access content'
|
||||
|
||||
|
||||
edlp_corpus.docsindex:
|
||||
path: '/docsindex'
|
||||
defaults:
|
||||
_controller: '\Drupal\edlp_corpus\Controller\CorpusController::docsindex'
|
||||
_title: 'Docs Index'
|
||||
requirements:
|
||||
_permission: 'access content'
|
||||
|
||||
edlp_corpus.docsindexajax:
|
||||
path: '/docsindex/ajax'
|
||||
defaults:
|
||||
_controller: '\Drupal\edlp_corpus\Controller\CorpusController::docsindexjson'
|
||||
_title: 'Docs Index'
|
||||
requirements:
|
||||
_permission: 'access content'
|
||||
|
||||
|
||||
edlp_corpus.lastdocs:
|
||||
path: '/lastdocs'
|
||||
defaults:
|
||||
|
||||
@@ -8,6 +8,11 @@ function template_preprocess_blockentrees(&$vars){
|
||||
'#items' => array(),
|
||||
);
|
||||
|
||||
$docsindex = $vars['docsindex_link']->toRenderable();
|
||||
$docsindex['#prefix'] = '<span class="oblique-wrapper">';
|
||||
$docsindex['#suffix'] = "</span>";
|
||||
$entrees['#items'][] = $docsindex;
|
||||
|
||||
foreach ($vars['entrees_items'] as $entree) {
|
||||
|
||||
$tid = $entree['tid'];
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
// use Drupal\Core\Url;
|
||||
|
||||
function template_preprocess_edlp_corpus_docsindex(&$vars){
|
||||
// dpm($vars);
|
||||
/*
|
||||
@see https://www.drupal8.ovh/index.php/en/tutoriels/339/render-a-node-or-an-entity
|
||||
*/
|
||||
$view_builder = \Drupal::entityTypeManager()->getViewBuilder('node');
|
||||
|
||||
if(count($vars['docsindex_nodes'])){
|
||||
$docsindex_list = array (
|
||||
'#theme' => 'item_list',
|
||||
'#items' => [],
|
||||
);
|
||||
foreach($vars['docsindex_nodes'] as $node){
|
||||
$docsindex_list['#items'][] = $view_builder->view($node, 'docsindex');
|
||||
}
|
||||
|
||||
$vars['docsindex'] = array(
|
||||
"#type"=>"container",
|
||||
"#attributes"=>array(
|
||||
"class"=>['docsindex']
|
||||
),
|
||||
"#markup"=>"<h3>".t("Documents Index")."</h3>",
|
||||
"docsindex"=>$docsindex_list
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -150,6 +150,133 @@ class CorpusController extends ControllerBase {
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ___ ___ _
|
||||
// | \ ___ __ __|_ _|_ _ __| |_____ __
|
||||
// | |) / _ \/ _(_-<| || ' \/ _` / -_) \ /
|
||||
// |___/\___/\__/__/___|_||_\__,_\___/_\_\
|
||||
|
||||
private function docsindexQuery() {
|
||||
// $language = \Drupal::languageManager()->getCurrentLanguage()->getId();
|
||||
|
||||
$query = \Drupal::entityQuery('node')
|
||||
->condition('status', 1)
|
||||
->condition('type', 'enregistrement')
|
||||
->sort('title', 'ASC');
|
||||
// ->range(0,50);
|
||||
|
||||
$nids = $query->execute();
|
||||
$nodes = entity_load_multiple('node', $nids);
|
||||
|
||||
// $current_langcode = \Drupal::languageManager()->getCurrentLanguage()->getId();
|
||||
|
||||
$this->docsindex_nodes = [];
|
||||
$this->docsindex_nids = [];
|
||||
foreach ($nodes as $node) {
|
||||
// remove masqué
|
||||
$sid = WorkflowManager::getCurrentStateId($node, 'field_workflow');
|
||||
if($sid != 'corpus_documents_publie') continue;
|
||||
|
||||
$this->docsindex_nodes[] = $node;
|
||||
// record an array of nids for corpus map filtering
|
||||
$this->docsindex_nids[] = $node->get('nid')->getString();
|
||||
|
||||
// // translate the node
|
||||
// $node = \Drupal::service('entity.repository')->getTranslationFromContext($node, $language);
|
||||
// $title = $this->stripAccent($node->getTitle());
|
||||
// $ordered_trans_nodes[$title] = $node;
|
||||
}
|
||||
|
||||
// // TODO: sort by title
|
||||
// ksort($ordered_trans_nodes);
|
||||
//
|
||||
// foreach ($ordered_trans_nodes as $title => $node) {
|
||||
// $this->docsindex_nodes[] = $node;
|
||||
// // record an array of nids for corpus map filtering
|
||||
// $this->docsindex_nids[] = $node->get('nid')->getString();
|
||||
// }
|
||||
}
|
||||
|
||||
// private function stripAccent($str){
|
||||
// return strtr(
|
||||
// utf8_decode($str),
|
||||
// utf8_decode('àáâãäçèéêëìíîïñòóôõöùúûüýÿÀÁÂÃÄÇÈÉÊËÌÍÎÏÑÒÓÔÕÖÙÚÛÜÝ'),
|
||||
// 'aaaaaceeeeiiiinooooouuuuyyAAAAACEEEEIIIINOOOOOUUUUY');
|
||||
// }
|
||||
|
||||
private function docsindexToRenderable(){
|
||||
$this->docsindexQuery();
|
||||
|
||||
return array(
|
||||
"#theme"=>'edlp_corpus_docsindex',
|
||||
'#docsindex_nodes' => $this->docsindex_nodes
|
||||
);
|
||||
|
||||
}
|
||||
/**
|
||||
* Display lastdocs as a page.
|
||||
*
|
||||
* @return renderable array
|
||||
*/
|
||||
public function docsindex() {
|
||||
return $this->docsindexToRenderable();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get lastdocs data as json through ajax.
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function docsindexjson() {
|
||||
|
||||
$renderable = $this->docsindexToRenderable();
|
||||
// $rendered = render($renderable);
|
||||
// We can't render directly the entity as it throw an exception with cachable data
|
||||
//http://blog.dcycle.com/blog/2018-01-24/caching-drupal-8-rest-resource/#the-dreaded-leaked-metadata-error
|
||||
$rendered = \Drupal::service('renderer')->executeInRenderContext(new RenderContext(), function () use ($renderable) {
|
||||
return render($renderable);
|
||||
});
|
||||
|
||||
$data = [
|
||||
'rendered'=> $rendered,
|
||||
'title'=>t('Documents Index'),
|
||||
'documents_lies' => $this->docsindex_nids,
|
||||
];
|
||||
|
||||
// translations links
|
||||
$route_name = 'edlp_corpus.docsindex';
|
||||
$links = \Drupal::languageManager()->getLanguageSwitchLinks(LanguageInterface::TYPE_URL, Url::fromRoute($route_name));
|
||||
if (isset($links->links)) {
|
||||
$translations_build = [
|
||||
'#theme' => 'links__language_block',
|
||||
'#links' => $links->links,
|
||||
'#attributes' => ['class' => ["language-switcher-{$links->method_id}",],],
|
||||
'#set_active_class' => TRUE,
|
||||
];
|
||||
$translations_rendered = \Drupal::service('renderer')->executeInRenderContext(new RenderContext(), function () use ($translations_build) {return render($translations_build);});
|
||||
|
||||
$data['translations_links'] = $translations_rendered;
|
||||
}
|
||||
|
||||
$data['#cache'] = [
|
||||
'max-age' => \Drupal\Core\Cache\Cache::PERMANENT,
|
||||
'tags' => ['edlp-docsindex-cache'],
|
||||
'contexts' => [
|
||||
'languages:language_content'
|
||||
]
|
||||
];
|
||||
|
||||
// $response = new JsonResponse();
|
||||
// $response->setData($data);
|
||||
$response = new CacheableJsonResponse($data);
|
||||
$response->addCacheableDependency(CacheableMetadata::createFromRenderArray($data));
|
||||
$response->addCacheableDependency(CacheableMetadata::createFromRenderArray($renderable));
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// _ _ _
|
||||
// | | __ _ __| |_ __| |___ __ ___
|
||||
// | |__/ _` (_-< _/ _` / _ \/ _(_-<
|
||||
|
||||
@@ -101,8 +101,19 @@ class BlockEntrees extends BlockBase {
|
||||
$entrees[] = $entree;
|
||||
}
|
||||
|
||||
// add general docs index link
|
||||
$url = Url::fromRoute('edlp_corpus.docsindex');
|
||||
$url->setOptions(array(
|
||||
'attributes' => array(
|
||||
'class' => ['docsindex-link', 'ajax-link'],
|
||||
'data-drupal-link-system-path' => $url->getInternalPath()
|
||||
)
|
||||
));
|
||||
$docsindex_link = Link::fromTextAndUrl('Index', $url);
|
||||
|
||||
return array (
|
||||
'#theme' => 'blockentrees',
|
||||
'#docsindex_link' => $docsindex_link,
|
||||
'#entrees_items' => $entrees,
|
||||
'#attached'=>array(
|
||||
'library' => array('edlp_corpus/corpus'),
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
|
||||
{{ entrees }}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{{ docsindex }}
|
||||
@@ -69,7 +69,6 @@ $this.height(Math.min($this.attr('init-height'),_$row.height()));});};function c
|
||||
function initCollectionNav(){void 0;$('.field--name-field-notice, .index','.taxonomy-term.vocabulary-entrees.home_mobile').addClass('closed');$('.field--name-field-notice>.field__label','.taxonomy-term.vocabulary-entrees.home_mobile').on('click',onClickCollectionNotice);$('.index>.field__label','.taxonomy-term.vocabulary-entrees.home_mobile').on('click',onClickCollectionIndex);};function onClickCollectionNotice(e){toggleEntreeOpening($(this).parent(),'notice');};function onClickCollectionIndex(e){toggleEntreeOpening($(this).parent(),'index');};function toggleEntreeOpening($e,part){$e.toggleClass('closed').parents('.taxonomy-term.vocabulary-entrees.home_mobile').toggleClass(part+'-opened');}
|
||||
function initSearch(){$('#edit-entries--wrapper legend','#edlp-search-form').on('click',function(){$(this).parent().toggleClass('opened');});};function initEnregistrementTranscript(){void 0;var $node=_$row.find('article.node--type-enregistrement.node--view-mode-transcript');var $nav=$('<nav>').prependTo($node);$node.find('.field--name-field-transcript-vo').addClass('visible').find('.field__label').clone().appendTo($nav).addClass('is-active').attr('field_target','.field--name-field-transcript-vo');$node.find('.field--name-field-transcript-trad').find('.field__label').clone().appendTo($nav).attr('field_target','.field--name-field-transcript-trad');$nav.find('.field__label').on('click',function(){var $this=$(this).addClass('is-active');$this.siblings('.is-active').removeClass('is-active');$this.parents('article.node').find('.field.visible').removeClass('visible');$this.parents('article.node').find($this.attr('field_target')).addClass('visible');});};function backToFrontPage(pop_state){void 0;closeAllModals();$('body').removeClass().addClass('path-frontpage');$('a[data-drupal-link-system-path="<front>"]').addClass('is-active');if(_corpus_ready){_$corpus_canvas.trigger({'type':'close-all-entree'});_$corpus_canvas.trigger({'type':'scramble-collection'});}
|
||||
if(typeof pop_state=="undefined"||!pop_state){void 0;history.pushState({home:true},null,drupalSettings.path.baseUrl+drupalSettings.path.currentLanguage);}}
|
||||
function initHome(){addCloseModalBtnToCols();return;void 0;var $grid=$('.grid',_$row).masonry({itemSelector:'.col',columnWidth:'.col-2',horizontalOrder:true,containerStyle:null,});$grid.imagesLoaded().progress(function(){$grid.masonry('layout');});$grid.imagesLoaded(function(){$grid.masonry('layout');});}
|
||||
function closeAllModals(){_$row.html('');_$ajaxLinks.removeClass('is-active');_$body.trigger({'type':'all-modal-closed'});};function checkRowEmpty(){void 0;if(!$('.col',_$row).length){if(!_$body.is('.entity-type-taxonomy_term.bundle-entrees')){if(!_$body.is('.entity-type-node.bundle-page')){if(_$body.is('.bundle-enregistrement.view-mode-article')&&$('a.articles-link').is('.is-active')){void 0;$('a.articles-link').removeClass('is-active').trigger('click');}else{backToFrontPage();}}else{if(_corpus_ready){_$corpus_canvas.trigger({'type':'scramble-collection'});}
|
||||
$('a[data-drupal-link-system-path="productions"]','#block-mainnavigation').removeClass('is-active').trigger('click');}}else{$('.entree-content a.is-active').removeClass('is-active');}}};init();}
|
||||
$(document).ready(function($){if(drupalSettings.path.isFront){var edlptheme=new EdlpTheme();}else{$('body').attr('booted','booted');}});})(jQuery,Drupal,drupalSettings);
|
||||
File diff suppressed because one or more lines are too long
@@ -1940,32 +1940,32 @@
|
||||
}
|
||||
}
|
||||
|
||||
function initHome(){
|
||||
addCloseModalBtnToCols();
|
||||
return;
|
||||
console.log('theme : initHome');
|
||||
var $grid = $('.grid',_$row).masonry({
|
||||
itemSelector:'.col',
|
||||
columnWidth:'.col-2',
|
||||
horizontalOrder: true,
|
||||
containerStyle: null,
|
||||
// disable initial layout
|
||||
// initLayout: false,
|
||||
});
|
||||
// bind event
|
||||
// $grid.masonry( 'on', 'layoutComplete', function() {
|
||||
// console.log('layout is complete');
|
||||
// function initHome(){
|
||||
// addCloseModalBtnToCols();
|
||||
// return;
|
||||
// console.log('theme : initHome');
|
||||
// var $grid = $('.grid',_$row).masonry({
|
||||
// itemSelector:'.col',
|
||||
// columnWidth:'.col-2',
|
||||
// horizontalOrder: true,
|
||||
// containerStyle: null,
|
||||
// // disable initial layout
|
||||
// // initLayout: false,
|
||||
// });
|
||||
|
||||
// layout Masonry after each image loads
|
||||
$grid.imagesLoaded().progress( function() {
|
||||
$grid.masonry('layout');
|
||||
});
|
||||
|
||||
$grid.imagesLoaded(function(){
|
||||
$grid.masonry('layout');
|
||||
});
|
||||
}
|
||||
// // bind event
|
||||
// // $grid.masonry( 'on', 'layoutComplete', function() {
|
||||
// // console.log('layout is complete');
|
||||
// // });
|
||||
//
|
||||
// // layout Masonry after each image loads
|
||||
// $grid.imagesLoaded().progress( function() {
|
||||
// $grid.masonry('layout');
|
||||
// });
|
||||
//
|
||||
// $grid.imagesLoaded(function(){
|
||||
// $grid.masonry('layout');
|
||||
// });
|
||||
// }
|
||||
|
||||
// __ __ _ _
|
||||
// | \/ |___ __| |__ _| |___
|
||||
|
||||
@@ -385,7 +385,8 @@ main[role="main"]{
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
article.node.node--type-enregistrement.node--view-mode-index{
|
||||
article.node.node--type-enregistrement.node--view-mode-index,
|
||||
article.node.node--type-enregistrement.node--view-mode-docsindex{
|
||||
&{margin:0}
|
||||
h2.node-title{margin-top: 0.6em; line-height: 1;}
|
||||
p{margin:0.1em 0;}
|
||||
@@ -530,7 +531,8 @@ main[role="main"]{
|
||||
}
|
||||
}
|
||||
|
||||
div.lastdocs{
|
||||
div.lastdocs,
|
||||
div.docsindex{
|
||||
article.node--type-enregistrement{
|
||||
h2.node-title{
|
||||
@include content_subtitles;
|
||||
@@ -2016,7 +2018,11 @@ footer{
|
||||
margin:0;
|
||||
white-space: nowrap;
|
||||
pointer-events: none;
|
||||
|
||||
// docsindex
|
||||
&:first-of-type{
|
||||
margin-right: 4em;
|
||||
}
|
||||
// articles
|
||||
&:last-of-type:not(.entree){
|
||||
margin-right: 5em;
|
||||
}
|
||||
@@ -2029,7 +2035,7 @@ footer{
|
||||
width:1.5em;
|
||||
}
|
||||
|
||||
a.term-link, a.articles-link{
|
||||
a.term-link, a.docsindex-link, a.articles-link{
|
||||
// outline: 1px solid blue;
|
||||
pointer-events: all;
|
||||
// background-color: #fff;
|
||||
@@ -2049,6 +2055,10 @@ footer{
|
||||
transition: background-color 0.1s ease-in-out;
|
||||
}
|
||||
|
||||
&.docsindex-link{
|
||||
// margin-right: 4em;
|
||||
text-transform: capitalize;
|
||||
}
|
||||
&.articles-link{
|
||||
margin-left: 4em;
|
||||
text-transform: capitalize;
|
||||
@@ -2171,6 +2181,7 @@ footer{
|
||||
// }
|
||||
.entree-content span.oblique-wrapper a:not(:hover):not(.is-active):before{background-color: #fff!important;}
|
||||
|
||||
a.docsindex-link:not(:hover):not(.is-active):before,
|
||||
a.articles-link:not(:hover):not(.is-active):before{
|
||||
background-color: #fff!important;
|
||||
}
|
||||
|
||||
@@ -150,127 +150,27 @@ 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);
|
||||
// }
|
||||
//
|
||||
// $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']);
|
||||
}
|
||||
|
||||
// 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')
|
||||
// ));
|
||||
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')
|
||||
// ));
|
||||
edlptheme_prepare_audio_link($vars);
|
||||
// dpm($vars['link_attributes']);
|
||||
}
|
||||
|
||||
function edlptheme_preprocess_node__enregistrement__docsindex(&$vars){
|
||||
edlptheme_prepare_audio_link($vars);
|
||||
}
|
||||
|
||||
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')
|
||||
// ));
|
||||
edlptheme_prepare_audio_link($vars);
|
||||
|
||||
// dpm($vars);
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<div class="col small-col-12 med-col-5 large-col-5">
|
||||
<div class="wrapper">
|
||||
{{ docsindex }}
|
||||
</div>
|
||||
</div>
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
{#
|
||||
/**
|
||||
* @file
|
||||
* Theme override to display a node.
|
||||
*
|
||||
* Available variables:
|
||||
* - node: The node entity with limited access to object properties and methods.
|
||||
* Only method names starting with "get", "has", or "is" and a few common
|
||||
* methods such as "id", "label", and "bundle" are available. For example:
|
||||
* - node.getCreatedTime() will return the node creation timestamp.
|
||||
* - node.hasField('field_example') returns TRUE if the node bundle includes
|
||||
* field_example. (This does not indicate the presence of a value in this
|
||||
* field.)
|
||||
* - node.isPublished() will return whether the node is published or not.
|
||||
* Calling other methods, such as node.delete(), will result in an exception.
|
||||
* See \Drupal\node\Entity\Node for a full list of public properties and
|
||||
* methods for the node object.
|
||||
* - label: The title of the node.
|
||||
* - content: All node items. Use {{ content }} to print them all,
|
||||
* or print a subset such as {{ content.field_example }}. Use
|
||||
* {{ content|without('field_example') }} to temporarily suppress the printing
|
||||
* of a given child element.
|
||||
* - author_picture: The node author user entity, rendered using the "compact"
|
||||
* view mode.
|
||||
* - metadata: Metadata for this node.
|
||||
* - date: Themed creation date field.
|
||||
* - author_name: Themed author name field.
|
||||
* - url: Direct URL of the current node.
|
||||
* - display_submitted: Whether submission information should be displayed.
|
||||
* - attributes: HTML attributes for the containing element.
|
||||
* The attributes.class element may contain one or more of the following
|
||||
* classes:
|
||||
* - node: The current template type (also known as a "theming hook").
|
||||
* - node--type-[type]: The current node type. For example, if the node is an
|
||||
* "Article" it would result in "node--type-article". Note that the machine
|
||||
* name will often be in a short form of the human readable label.
|
||||
* - node--view-mode-[view_mode]: The View Mode of the node; for example, a
|
||||
* teaser would result in: "node--view-mode-teaser", and
|
||||
* full: "node--view-mode-full".
|
||||
* The following are controlled through the node publishing options.
|
||||
* - node--promoted: Appears on nodes promoted to the front page.
|
||||
* - node--sticky: Appears on nodes ordered above other non-sticky nodes in
|
||||
* teaser listings.
|
||||
* - node--unpublished: Appears on unpublished nodes visible only to site
|
||||
* admins.
|
||||
* - title_attributes: Same as attributes, except applied to the main title
|
||||
* tag that appears in the template.
|
||||
* - content_attributes: Same as attributes, except applied to the main
|
||||
* content tag that appears in the template.
|
||||
* - author_attributes: Same as attributes, except applied to the author of
|
||||
* the node tag that appears in the template.
|
||||
* - title_prefix: Additional output populated by modules, intended to be
|
||||
* displayed in front of the main title tag that appears in the template.
|
||||
* - title_suffix: Additional output populated by modules, intended to be
|
||||
* displayed after the main title tag that appears in the template.
|
||||
* - view_mode: View mode; for example, "teaser" or "full".
|
||||
* - teaser: Flag for the teaser state. Will be true if view_mode is 'teaser'.
|
||||
* - page: Flag for the full page state. Will be true if view_mode is 'full'.
|
||||
* - readmore: Flag for more state. Will be true if the teaser content of the
|
||||
* node cannot hold the main body content.
|
||||
* - logged_in: Flag for authenticated user status. Will be true when the
|
||||
* current user is a logged-in member.
|
||||
* - is_admin: Flag for admin user status. Will be true when the current user
|
||||
* is an administrator.
|
||||
*
|
||||
* @see template_preprocess_node()
|
||||
*
|
||||
* @todo Remove the id attribute (or make it a class), because if that gets
|
||||
* rendered twice on a page this is invalid CSS for example: two lists
|
||||
* in different view modes.
|
||||
*/
|
||||
#}
|
||||
{%
|
||||
set classes = [
|
||||
'node',
|
||||
'node--type-' ~ node.bundle|clean_class,
|
||||
node.isPromoted() ? 'node--promoted',
|
||||
node.isSticky() ? 'node--sticky',
|
||||
not node.isPublished() ? 'node--unpublished',
|
||||
view_mode ? 'node--view-mode-' ~ view_mode|clean_class,
|
||||
]
|
||||
%}
|
||||
{{ attach_library('classy/node') }}
|
||||
<article{{ attributes.addClass(classes) }}>
|
||||
<div class="entrees">
|
||||
{# THIS IS REALLY DIRTY !! #}
|
||||
{% for key, child in content.field_entrees if key|first != '#' %}
|
||||
{% set tid = child['#cache']['tags'][0]|replace({'taxonomy_term:':''}) %}
|
||||
<span class="entree" tid="{{ tid }}" title="{{ child }}"></span>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<h2{{ title_attributes.addClass('node-title') }}>
|
||||
<a href="{{ url }}" rel="bookmark" {{ link_attributes }}>{{ label }}</a>
|
||||
</h2>
|
||||
<div class="description">
|
||||
{{ content.field_description }}
|
||||
</div>
|
||||
</article>
|
||||
Reference in New Issue
Block a user