delete composition ajax link is working !
This commit is contained in:
@@ -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)),
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user