PHP Class Sonata\ProductBundle\Menu\ProductMenuBuilder

Author: Hugo Briand ([email protected])
Afficher le fichier Open project: sonata-project/ecommerce Class Usage Examples

Protected Properties

Свойство Type Description
$categoryManager Sonata\Component\Product\ProductCategoryManagerInterface
$factory Knp\Menu\FactoryInterface
$router Symfony\Component\Routing\RouterInterface

Méthodes publiques

Méthode Description
__construct ( Knp\Menu\FactoryInterface $factory, Sonata\Component\Product\ProductCategoryManagerInterface $categoryManager, Symfony\Component\Routing\RouterInterface $router ) Constructor.
buildCategoryMenu ( Knp\Menu\ItemInterface $menu, array $options = [], string $currentUri = null )
createCategoryMenu ( array $itemOptions = [], string $currentUri = null ) : Knp\Menu\ItemInterface
createFiltersMenu ( Sonata\Component\Product\ProductProviderInterface $productProvider, array $itemOptions = [], string $currentUri = null ) : mixed Generates the filters menu based on $productProvider.

Méthodes protégées

Méthode Description
fillMenu ( Knp\Menu\ItemInterface $menu, array $categories, array $options = [], string $currentUri = null ) Recursive method to fill $menu with $categories.
getCategoryTitle ( Sonata\ClassificationBundle\Model\CategoryInterface $category, integer $limit = 500 ) : string Gets the HTML associated with the category menu title.
getFilterName ( $filter, $option ) : string Generates the name of the filter based on $filter and $option.
getFilterUri ( $currentUri, $filter, $option ) : string Generates the filter uri.

Method Details

__construct() public méthode

Constructor.
public __construct ( Knp\Menu\FactoryInterface $factory, Sonata\Component\Product\ProductCategoryManagerInterface $categoryManager, Symfony\Component\Routing\RouterInterface $router )
$factory Knp\Menu\FactoryInterface
$categoryManager Sonata\Component\Product\ProductCategoryManagerInterface
$router Symfony\Component\Routing\RouterInterface

buildCategoryMenu() public méthode

public buildCategoryMenu ( Knp\Menu\ItemInterface $menu, array $options = [], string $currentUri = null )
$menu Knp\Menu\ItemInterface The item to fill with $routes
$options array The item options
$currentUri string The current URI

createCategoryMenu() public méthode

public createCategoryMenu ( array $itemOptions = [], string $currentUri = null ) : Knp\Menu\ItemInterface
$itemOptions array The options given to the created menuItem
$currentUri string The current URI
Résultat Knp\Menu\ItemInterface

createFiltersMenu() public méthode

Generates the filters menu based on $productProvider.
public createFiltersMenu ( Sonata\Component\Product\ProductProviderInterface $productProvider, array $itemOptions = [], string $currentUri = null ) : mixed
$productProvider Sonata\Component\Product\ProductProviderInterface
$itemOptions array
$currentUri string
Résultat mixed

fillMenu() protected méthode

Recursive method to fill $menu with $categories.
protected fillMenu ( Knp\Menu\ItemInterface $menu, array $categories, array $options = [], string $currentUri = null )
$menu Knp\Menu\ItemInterface
$categories array
$options array
$currentUri string

getCategoryTitle() protected méthode

Gets the HTML associated with the category menu title.
protected getCategoryTitle ( Sonata\ClassificationBundle\Model\CategoryInterface $category, integer $limit = 500 ) : string
$category Sonata\ClassificationBundle\Model\CategoryInterface A category instance
$limit integer A limit for calculation (fixed to 500 by default)
Résultat string

getFilterName() protected méthode

Generates the name of the filter based on $filter and $option.
protected getFilterName ( $filter, $option ) : string
$filter
$option
Résultat string

getFilterUri() protected méthode

Generates the filter uri.
protected getFilterUri ( $currentUri, $filter, $option ) : string
$currentUri
$filter
$option
Résultat string

Property Details

$categoryManager protected_oe property

protected ProductCategoryManagerInterface,Sonata\Component\Product $categoryManager
Résultat Sonata\Component\Product\ProductCategoryManagerInterface

$factory protected_oe property

protected FactoryInterface,Knp\Menu $factory
Résultat Knp\Menu\FactoryInterface

$router protected_oe property

protected RouterInterface,Symfony\Component\Routing $router
Résultat Symfony\Component\Routing\RouterInterface