Exemplo n.º 1
0
 /**
  * Generates the filters menu based on $productProvider
  *
  * @param ProductProviderInterface $productProvider
  * @param array                    $itemOptions
  * @param string                   $currentUri
  *
  * @return mixed
  */
 public function createFiltersMenu(ProductProviderInterface $productProvider, array $itemOptions = array(), $currentUri = null)
 {
     $menu = $this->factory->createItem('filters', $itemOptions);
     $filters = $productProvider->getFilters();
     foreach ($filters as $filter => $options) {
         $menuItem = $menu->addChild($filter, array_merge(array('attributes' => array('class' => 'nav-header')), $itemOptions));
         foreach ($options as $option) {
             $filterItemOptions = array_merge(array('uri' => $this->getFilterUri($currentUri, $filter, $option)), $itemOptions);
             $menuItem->addChild($this->getFilterName($filter, $option), $filterItemOptions);
         }
     }
     return $menu;
 }
Exemplo n.º 2
0
 /**
  * Returns a new travel variation entity
  *
  * @param \Sonata\Component\Product\ProductProviderInterface $provider
  * @param \Sonata\Component\Product\ProductInterface $parent
  *
  * @return Travel
  */
 protected function generateDefaultTravelVariation($provider, $parent)
 {
     $entity = $provider->createVariation($parent);
     $entity->setEnabled(true);
     return $entity;
 }