Example #1
0
 /**
  * {@inheritdoc}
  */
 public function renderAction(GridView $gridView, Action $action, $data = null)
 {
     if (!isset($this->actionTemplates[$type = $action->getType()])) {
         throw new \InvalidArgumentException(sprintf('Missing template for action type "%s".', $type));
     }
     return $this->twig->render($this->actionTemplates[$type], ['grid' => $gridView, 'action' => $action, 'data' => $data]);
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public function renderAction(GridViewInterface $gridView, Action $action, $data = null)
 {
     $type = $action->getType();
     if (!isset($this->actionTemplates[$type])) {
         throw new \InvalidArgumentException(sprintf('Missing template for action type "%s".', $type));
     }
     $options = $this->optionsParser->parseOptions($action->getOptions(), $gridView->getRequestConfiguration()->getRequest(), $data);
     return $this->twig->render($this->actionTemplates[$type], ['grid' => $gridView, 'action' => $action, 'data' => $data, 'options' => $options]);
 }
Example #3
0
 function it_throws_an_exception_if_template_is_not_configured_for_given_action_type(GridView $gridView, Action $action)
 {
     $action->getType()->willReturn('foo');
     $this->shouldThrow(new \InvalidArgumentException('Missing template for action type "foo".'))->during('renderAction', [$gridView, $action]);
 }