Created
July 15, 2011 09:31
-
-
Save makasim/1084388 to your computer and use it in GitHub Desktop.
how to add custom action for selected ids in WhiteOctoberAdminBundle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class ArticleAdmin extends DoctrineORMAdmin | |
{ | |
protected function configure() | |
{ | |
// this clouse will be called | |
$batchActions['approve'] = function($selected, $container, $batchAction) { | |
var_dump($selected); | |
}; | |
$batchCollection = new BatchActionCollection(); | |
$batchCollection->get('batch')->setOption('actions', $batchActions); | |
$this | |
->setName('Articles') | |
->setDataClass('Rj\\BlogBundle\\Entity\Article') | |
->addFields(array('title', 'authorName', 'creationTime')) | |
->addAction($batchCollection) | |
// you need jquery enabled for the plugin. in my case it is done in layout | |
->setBaseTemplate('CoreBundle:Layout:default.html.twig') | |
->setActionOption('doctrine.orm.list', 'batch', true) | |
->setActionOption('doctrine.orm.list', 'batch_actions', array('approve' => 'Approve')) | |
; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment