delete composition ajax link is working !

This commit is contained in:
Bachir Soussi Chiadmi
2018-03-24 11:40:51 +01:00
parent 6cc38d3300
commit eed0b50970
7 changed files with 268 additions and 37 deletions
@@ -11,20 +11,41 @@ function template_preprocess_edlp_compositions_list(&$vars){
);
foreach($vars['composition_entities'] as $entity){
// get the url
$url = Url::fromRoute('entity.composition.canonical', ['composition' => $entity->id()], ['absolute' => TRUE]);
$url = Url::fromRoute('entity.composition.canonical',
['composition' => $entity->id()], ['absolute' => TRUE]);
// get the delete url
$delete_url = Url::fromRoute('edlp_studio.composition_controller_action_ajax',
['action' => 'delete', 'cid'=>$entity->id()], ['absolute' => TRUE]);
$title = $entity->getName();
$vars['compositions']['#items'][] = array(
'#title' => $title,
'#type' => 'link',
'#url' => $url,
'#options'=>array(
'attributes' => array(
'data-drupal-link-system-path' => $url->getInternalPath(),
'nid' => $entity->id(),
'class' => ['composition-link'],
'title'=>$title,
'compo_link' => array(
'#title' => $title,
'#type' => 'link',
'#url' => $url,
'#options'=>array(
'attributes' => array(
'data-drupal-link-system-path' => $url->getInternalPath(),
'nid' => $entity->id(),
'class' => ['composition-link'],
'title'=>$title,
),
),
),
'delete_link' => array(
'#title' => "delete",
'#type' => 'link',
'#url' => $delete_url,
'#options'=>array(
'attributes' => array(
'data-drupal-link-system-path' => $delete_url->getInternalPath(),
'nid' => $entity->id(),
'class' => ['delete-composition-link'],
'title'=> t('Delete @title', array('@title'=>$title)),
),
),
)
);
}