Example #1
0
 /**
  * @param \Twig_Environment $env
  * @param \Leapt\AdminBundle\Datalist\Action\DatalistActionInterface $action
  * @param mixed $item
  * @return string
  * @throws \Exception
  */
 public function renderDatalistAction(\Twig_Environment $env, DatalistActionInterface $action, $item)
 {
     $blockNames = [$action->getType()->getBlockName() . '_action', '_' . $action->getDatalist()->getName() . '_' . $action->getName() . '_action'];
     $viewContext = new ViewContext();
     $action->getType()->buildViewContext($viewContext, $action, $item, $action->getOptions());
     return $this->renderBlock($env, $action->getDatalist(), $blockNames, $viewContext->all());
 }
Example #2
0
 /**
  * @param Action\DatalistActionInterface $action
  * @return DatalistInterface
  */
 public function addAction(DatalistActionInterface $action)
 {
     $this->actions[$action->getName()] = $action;
     return $this;
 }