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\EntityInterface;
|
||||||
use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
|
use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
|
||||||
use Drupal\Core\Url;
|
use Drupal\Core\Url;
|
||||||
|
use Drupal\Core\Link;
|
||||||
use Drupal\workflow\Entity\WorkflowManager;
|
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)
|
// build the array of relateds classified by page_type (taxonomy)
|
||||||
$relateds = array();
|
$relateds = array();
|
||||||
foreach ($nodes as $nid => $node) {
|
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');
|
// 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');
|
// 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');
|
// dpm($relateds, 'relateds');
|
||||||
|
|
||||||
// if relateds, build the sentence for display and the render array
|
// if relateds, build the sentence for display and the render array
|
||||||
if(count($relateds)){
|
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) {
|
// foreach ($relateds as $cat => $titles) {
|
||||||
$relations .= '<span class="cat">' . $cat . ' :</span> ' . implode(', ', $titles) . ' | ';
|
// // $relations .= '<span class="cat">' . $cat . ' :</span> ' . implode(', ', $titles) . ' | ';
|
||||||
}
|
// $relations[] =
|
||||||
|
// }
|
||||||
|
|
||||||
$relations = preg_replace('/\s\|\s$/', '', $relations);
|
// $relations = preg_replace('/\s\|\s$/', '', $relations);
|
||||||
$relations .= '</p>';
|
// $relations .= '</p>';
|
||||||
|
|
||||||
$build['relations'] = array(
|
$build['relations'] = array(
|
||||||
'#type'=>"container",
|
'#type'=>"container",
|
||||||
'#attributes'=>array(
|
'#attributes'=>array(
|
||||||
'class'=>'relations'
|
'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;
|
top: 0; left:0;
|
||||||
background-color: white;
|
background-color: white;
|
||||||
height:100%; min-width: 100%;
|
height:100%; min-width: 100%;
|
||||||
opacity: 0;
|
opacity: 1;
|
||||||
transition: opacity 0.2s ease-in-out;
|
transition: opacity 0.2s ease-in-out;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
&>*{
|
&>*{
|
||||||
@@ -702,15 +702,35 @@ main[role="main"]{
|
|||||||
.col-right{
|
.col-right{
|
||||||
border-left:1px solid #1A1A1A;
|
border-left:1px solid #1A1A1A;
|
||||||
margin-left:5px; padding-left:5px;
|
margin-left:5px; padding-left:5px;
|
||||||
|
max-width: calc(100% - 100px);
|
||||||
h3{
|
h3{
|
||||||
font-size: 0.82em;
|
// display: inline;
|
||||||
|
// float: left;
|
||||||
|
@include content_subtitles;
|
||||||
margin:0;
|
margin:0;
|
||||||
}
|
}
|
||||||
p{
|
div.item-list{
|
||||||
font-size: 0.756em;
|
// float: left;
|
||||||
margin:0;
|
// display: inline;
|
||||||
span.cat{
|
max-width: 100%;
|
||||||
font-weight: 600;
|
}
|
||||||
|
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