changed relation for document on player cartel
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
use Drupal\Core\Entity\EntityInterface;
|
||||
use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
|
||||
use Drupal\Core\Url;
|
||||
use Drupal\Core\Link;
|
||||
use Drupal\workflow\Entity\WorkflowManager;
|
||||
|
||||
|
||||
@@ -118,31 +119,48 @@ function edlp_corpus_node_view(array &$build, EntityInterface $entity, EntityVie
|
||||
// build the array of relateds classified by page_type (taxonomy)
|
||||
$relateds = array();
|
||||
foreach ($nodes as $nid => $node) {
|
||||
$page_type = $node->get('field_page_type')->get(0)->getValue();
|
||||
// $page_type = $node->get('field_page_type')->get(0)->getValue();
|
||||
// dpm($page_type, 'page_type');
|
||||
$term = entity_load('taxonomy_term', $page_type['target_id']);
|
||||
// $term = entity_load('taxonomy_term', $page_type['target_id']);
|
||||
// dpm($term, 'term');
|
||||
$relateds[$term->getName()][] = $node->getTitle();
|
||||
// $relateds[$term->getName()][] = $node->getTitle();
|
||||
$url = Url::fromRoute('entity.node.canonical', ['node'=>$node->id()]);
|
||||
$url->setOptions(array(
|
||||
'attributes' => array(
|
||||
'class' => ['ajax-link'],
|
||||
'data-drupal-link-system-path' => $url->getInternalPath()
|
||||
)
|
||||
));
|
||||
$link = Link::fromTextAndUrl(trim($node->getTitle()), $url);
|
||||
// $relateds[$term->getName()][] = $link;
|
||||
$relateds[] = $link->toRenderable();
|
||||
}
|
||||
// dpm($relateds, 'relateds');
|
||||
|
||||
// if relateds, build the sentence for display and the render array
|
||||
if(count($relateds)){
|
||||
$relations = '<h3>' . t('This sound is about :') . '</h3><p>';
|
||||
// $relations = '<h3>' . t('This sound is about :') . '</h3>';
|
||||
|
||||
foreach ($relateds as $cat => $titles) {
|
||||
$relations .= '<span class="cat">' . $cat . ' :</span> ' . implode(', ', $titles) . ' | ';
|
||||
}
|
||||
// foreach ($relateds as $cat => $titles) {
|
||||
// // $relations .= '<span class="cat">' . $cat . ' :</span> ' . implode(', ', $titles) . ' | ';
|
||||
// $relations[] =
|
||||
// }
|
||||
|
||||
$relations = preg_replace('/\s\|\s$/', '', $relations);
|
||||
$relations .= '</p>';
|
||||
// $relations = preg_replace('/\s\|\s$/', '', $relations);
|
||||
// $relations .= '</p>';
|
||||
|
||||
$build['relations'] = array(
|
||||
'#type'=>"container",
|
||||
'#attributes'=>array(
|
||||
'class'=>'relations'
|
||||
),
|
||||
"#markup"=> $relations,
|
||||
'title' => array(
|
||||
"#markup"=> '<h3>' . t('This sound is about :') . '</h3>',
|
||||
),
|
||||
'content' => array (
|
||||
'#theme' => 'item_list',
|
||||
'#items' => $relateds,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -684,7 +684,7 @@ main[role="main"]{
|
||||
top: 0; left:0;
|
||||
background-color: white;
|
||||
height:100%; min-width: 100%;
|
||||
opacity: 0;
|
||||
opacity: 1;
|
||||
transition: opacity 0.2s ease-in-out;
|
||||
white-space: nowrap;
|
||||
&>*{
|
||||
@@ -702,15 +702,35 @@ main[role="main"]{
|
||||
.col-right{
|
||||
border-left:1px solid #1A1A1A;
|
||||
margin-left:5px; padding-left:5px;
|
||||
max-width: calc(100% - 100px);
|
||||
h3{
|
||||
font-size: 0.82em;
|
||||
// display: inline;
|
||||
// float: left;
|
||||
@include content_subtitles;
|
||||
margin:0;
|
||||
}
|
||||
p{
|
||||
font-size: 0.756em;
|
||||
margin:0;
|
||||
span.cat{
|
||||
font-weight: 600;
|
||||
div.item-list{
|
||||
// float: left;
|
||||
// display: inline;
|
||||
max-width: 100%;
|
||||
}
|
||||
ul{
|
||||
// display: inline;
|
||||
max-width: 100%;
|
||||
padding:0; margin:0;
|
||||
li{
|
||||
padding:0; margin:0;
|
||||
display: inline-block;
|
||||
list-style: none;
|
||||
&:not(:last-of-type){
|
||||
margin-right:0.4em;
|
||||
&:after{
|
||||
content:","
|
||||
}
|
||||
}
|
||||
a{
|
||||
@include content_courant;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user