studio chutier is updating when documents added or removed, also added remove link in document list
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
use \Drupal\Core\Url;
|
||||
use Drupal\Component\Utility\Unicode;
|
||||
|
||||
use Drupal\edlp_studio\Entity\Chutier;
|
||||
|
||||
function template_preprocess_edlp_chutier_ui(&$vars){
|
||||
// dpm($vars);
|
||||
// $view_builder = \Drupal::entityTypeManager()->getViewBuilder('node');
|
||||
@@ -34,23 +36,44 @@ function template_preprocess_edlp_chutier_ui(&$vars){
|
||||
foreach ($node->get('field_entrees')->getValue() as $key => $term) {
|
||||
$entrees .= '<span class="entree" tid="'.$term['target_id'].'"></span>';
|
||||
}
|
||||
//
|
||||
// get the remove url (obviously as we are in chutier all contents actions are remove ;)
|
||||
$remove_url = Chutier::getActionsUrl($node->id(), $vars['uid']);
|
||||
|
||||
// build the link
|
||||
$vars['documents']['#items'][] = array(
|
||||
'#prefix' => '<div class="entrees">'.$entrees.'</div>',
|
||||
'#title' => $trunc_title,
|
||||
'#type' => 'link',
|
||||
'#url' => $url,
|
||||
'#options'=>array(
|
||||
'attributes' => array(
|
||||
'data-drupal-link-system-path' => $url->getInternalPath(),
|
||||
'audio_url' => $son_url,
|
||||
'nid' => $node->id(),
|
||||
// 'tid' => $entrees[mt_rand(0, count($entrees) - 1)],
|
||||
// 'entries_size' => count($entrees),
|
||||
'class' => $classes,
|
||||
'title'=>$title,
|
||||
)
|
||||
)
|
||||
'#type' => 'container',
|
||||
'entrees' => array(
|
||||
'#type' => 'container',
|
||||
'#attributes'=>['class'=>['entrees']],
|
||||
'#markup'=>$entrees,
|
||||
),
|
||||
'link'=>array(
|
||||
'#title' => $trunc_title,
|
||||
'#type' => 'link',
|
||||
'#url' => $url,
|
||||
'#options'=>array(
|
||||
'attributes' => array(
|
||||
'data-drupal-link-system-path' => $url->getInternalPath(),
|
||||
'audio_url' => $son_url,
|
||||
'nid' => $node->id(),
|
||||
// 'tid' => $entrees[mt_rand(0, count($entrees) - 1)],
|
||||
// 'entries_size' => count($entrees),
|
||||
'class' => $classes,
|
||||
'title'=>$title,
|
||||
),
|
||||
),
|
||||
),
|
||||
'remove_link' => array(
|
||||
'#title' => t("Chutier."),
|
||||
'#type' => 'link',
|
||||
'#url' => $remove_url,
|
||||
'#options'=>array(
|
||||
'attributes' => array(
|
||||
'data-drupal-link-system-path' => $remove_url->getInternalPath()
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user