Search code examples
symfony1admin-generator

Symfony generator.yml link method


How do I specify the method of an action (similar to _delete):

generator:
  config:
    list:
      object_actions:
        myaction: {label: Label, action: myaction, method: post}

This ignores my method setting and renders a get link:

<a href="/backend/myaction/1">Label</a>

Whereas I want it to a "post" link, similar to _delete (with onclick attribute)


Solution

  • I guess your using Propel.

    If you check the generator code, specifically on: generator > theme_name > template > template > _list_td_actions.php, there you'll find a pice of code like:

    <?php else: ?>
        <li class="sf_admin_action_<?php echo $params['class_suffix'] ?>">
          <?php echo $this->addCredentialCondition($this->getLinkToAction($name, $params, true), $params) ?>
    
        </li>
    <?php endif; ?>
    

    That's the code thats being executed when you define a custom object action like the one you described. Check $params and you may find a solution to your needs ( i think that probably you could define something like the onclick attribute value).