/** * {@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]); }
/** * {@inheritdoc} */ public function renderFilter(GridViewInterface $gridView, Filter $filter) { $template = $this->getFilterTemplate($filter); $form = $this->formFactory->createNamed('criteria', FormType::class, [], ['csrf_protection' => false, 'required' => false]); $form->add($filter->getName(), $this->formTypeRegistry->get($filter->getType(), 'default'), $filter->getOptions()); $criteria = $gridView->getParameters()->get('criteria', []); $form->submit($criteria); return $this->twig->render($template, ['grid' => $gridView, 'filter' => $filter, 'form' => $form->get($filter->getName())->createView()]); }