コード例 #1
0
ファイル: TwigGridRenderer.php プロジェクト: okwinza/Sylius
 /**
  * {@inheritdoc}
  */
 public function renderFilter(GridView $gridView, Filter $filter)
 {
     if (!isset($this->filterTemplates[$type = $filter->getType()])) {
         throw new \InvalidArgumentException(sprintf('Missing template for filter type "%s".', $type));
     }
     $form = $this->formFactory->createNamed('criteria', 'form', [], ['csrf_protection' => false, 'required' => false]);
     $form->add($filter->getName(), sprintf('sylius_grid_filter_%s', $filter->getType()), $filter->getOptions());
     $criteria = $gridView->getParameters()->get('criteria', []);
     $form->submit($criteria);
     return $this->twig->render($this->filterTemplates[$type], ['grid' => $gridView, 'filter' => $filter, 'form' => $form->get($filter->getName())->createView()]);
 }
コード例 #2
0
 /**
  * @param mixed $data
  * @param Grid $gridDefinition
  * @param Parameters $parameters
  * @param MetadataInterface $resourceMetadata
  * @param RequestConfiguration $requestConfiguration
  */
 public function __construct($data, Grid $gridDefinition, Parameters $parameters, MetadataInterface $resourceMetadata, RequestConfiguration $requestConfiguration)
 {
     parent::__construct($data, $gridDefinition, $parameters);
     $this->metadata = $resourceMetadata;
     $this->requestConfiguration = $requestConfiguration;
 }