in the objects list generated with the admin generator, the batch Action are shown in a select with a submit button.
I want to transform it and get only link (for example i have the action delete and i want to have a link to delete instead of choosingthe action and than click on the button.)
i have the _list_batch_actions.php file but i could’nt see how to get the href for the tag:
<li class="sf_admin_batch_actions_choice">
<a href="<?php // url_for('@route')?>"> test</a> // this is what i added but not woorking
<select name="batch_action">
<option value=""><?php echo __('Choose an action', array(), 'sf_admin') ?></option>
<option value="batchDelete"><?php echo __('Delete', array(), 'sf_admin') ?></option>
</select>
<?php $form = new BaseForm(); if ($form->isCSRFProtected()): ?>
<input type="hidden" name="<?php echo $form->getCSRFFieldName() ?>" value="<?php echo $form->getCSRFToken() ?>" />
<?php endif; ?>
<input type="submit" value="<?php echo __('go', array(), 'sf_admin') ?>" />
</li>
Any idea on how i can use it ?
Solution one:
The batch actions are submitted by form by default. You can rewrite the template to put links instead of a form.
Check your auto generated controler in the cache
(you need before to see your admin page in order to generate the cache).
You will find a function
executeBatch().You can copy this function and put it in your admin module controler and then modify its behaviour in order to do what you need.
Solution two:
Use javascript to hide your form and put a link which will select the delete action in your select box, the submit the form using javascript.