/** * inject our config and custom matcher. */ public function __construct() { $matcher = new Matcher(); $matcher->addVoter(new UriVoter(app('url')->current())); $matcher->addVoter(new RouteVoter(app('request'))); $options = config('menu.render'); parent::__construct($matcher, $options); }
/** * Constructor. * * @param ContainerInterface $container * @param FactoryInterface $factory */ public function __construct(ContainerInterface $container, FactoryInterface $factory) { $this->container = $container; $this->factory = $factory; $matcher = new Matcher(); try { $request = $this->container->get('request_stack')->getCurrentRequest(); $voter = new RouteVoter($request); $matcher->addVoter($voter); } catch (InactiveScopeException $e) { // We are most probably running from the command line, which means there is no 'request' service. // We just gracefully continue } parent::__construct($matcher, array('allow_safe_labels' => true, 'currentClass' => 'active')); }
/** * @DI\InjectParams({ * "matcher" = @DI\Inject("knp_menu.matcher"), * "defaultOptions" = @DI\Inject("%knp_menu.renderer.list.options%"), * "charset" = @DI\Inject("%kernel.charset%") * }) */ public function __construct($matcher, $defaultOptions, $charset) { $defaultOptions['leaf_class'] = $defaultOptions["branch_class"] = "btn btn-default user-additional-action"; parent::__construct($matcher, $defaultOptions, $charset); }
/** * @DI\InjectParams({ * "matcher" = @DI\Inject("knp_menu.matcher"), * "defaultOptions" = @DI\Inject("%knp_menu.renderer.list.options%"), * "charset" = @DI\Inject("%kernel.charset%") * }) */ public function __construct($matcher, $defaultOptions, $charset) { $defaultOptions['leaf_class'] = $defaultOptions["branch_class"] = "list-group-item"; parent::__construct($matcher, $defaultOptions, $charset); }
/** * @DI\InjectParams({ * "matcher" = @DI\Inject("knp_menu.matcher"), * "defaultOptions" = @DI\Inject("%knp_menu.renderer.list.options%"), * "charset" = @DI\Inject("%kernel.charset%") * }) */ public function __construct($matcher, $defaultOptions, $charset) { parent::__construct($matcher, $defaultOptions, $charset); }
/** * @DI\InjectParams({ * "matcher" = @DI\Inject("knp_menu.matcher"), * "defaultOptions" = @DI\Inject("%knp_menu.renderer.list.options%"), * "charset" = @DI\Inject("%kernel.charset%") * }) */ public function __construct($matcher, $defaultOptions, $charset) { $defaultOptions['leaf_class'] = $defaultOptions['branch_class'] = 'btn btn-default workspace-additional-action'; parent::__construct($matcher, $defaultOptions, $charset); }
public function __construct(MatcherInterface $matcher, MenuManipulator $manipulator, array $defaultOptions = array(), $charset = null) { parent::__construct($matcher, $defaultOptions, $charset); $this->manipulator = $manipulator; }