diff --git a/Model/Breadcrumbs.php b/Model/Breadcrumbs.php index 5795eca..f51123f 100644 --- a/Model/Breadcrumbs.php +++ b/Model/Breadcrumbs.php @@ -17,62 +17,62 @@ class Breadcrumbs implements \Iterator, \ArrayAccess, \Countable */ private $router; - public function addItem($text, $url = "", array $translationParameters = array()) + public function addItem($text, $url = "", array $translationParameters = array(), $translate = true) { - return $this->addNamespaceItem(self::DEFAULT_NAMESPACE, $text, $url, $translationParameters); + return $this->addNamespaceItem(self::DEFAULT_NAMESPACE, $text, $url, $translationParameters, $translate); } - public function addNamespaceItem($namespace, $text, $url = "", array $translationParameters = array()) + public function addNamespaceItem($namespace, $text, $url = "", array $translationParameters = array(), $translate = true) { - $b = new SingleBreadcrumb($text, $url, $translationParameters); + $b = new SingleBreadcrumb($text, $url, $translationParameters, $translate); $this->breadcrumbs[$namespace][] = $b; return $this; } - public function prependItem($text, $url = "", array $translationParameters = array()) + public function prependItem($text, $url = "", array $translationParameters = array(), $translate = true) { - return $this->prependNamespaceItem(self::DEFAULT_NAMESPACE, $text, $url, $translationParameters); + return $this->prependNamespaceItem(self::DEFAULT_NAMESPACE, $text, $url, $translationParameters, $translate); } - public function prependNamespaceItem($namespace, $text, $url = "", array $translationParameters = array()) + public function prependNamespaceItem($namespace, $text, $url = "", array $translationParameters = array(), $translate = true) { - $b = new SingleBreadcrumb($text, $url, $translationParameters); + $b = new SingleBreadcrumb($text, $url, $translationParameters, $translate); array_unshift($this->breadcrumbs[$namespace], $b); return $this; } - public function addRouteItem($text, $route, array $parameters = array(), $referenceType = RouterInterface::ABSOLUTE_PATH, array $translationParameters = array()) + public function addRouteItem($text, $route, array $parameters = array(), $referenceType = RouterInterface::ABSOLUTE_PATH, array $translationParameters = array(), $translate = true) { - return $this->addNamespaceRouteItem(self::DEFAULT_NAMESPACE, $text, $route, $parameters, $referenceType, $translationParameters); + return $this->addNamespaceRouteItem(self::DEFAULT_NAMESPACE, $text, $route, $parameters, $referenceType, $translationParameters, $translate); } - public function addNamespaceRouteItem($namespace, $text, $route, array $parameters = array(), $referenceType = RouterInterface::ABSOLUTE_PATH, array $translationParameters = array()) + public function addNamespaceRouteItem($namespace, $text, $route, array $parameters = array(), $referenceType = RouterInterface::ABSOLUTE_PATH, array $translationParameters = array(), $translate = true) { $url = $this->router->generate($route, $parameters, $referenceType); - return $this->addNamespaceItem($namespace, $text, $url, $translationParameters); + return $this->addNamespaceItem($namespace, $text, $url, $translationParameters, $translate); } - public function prependRouteItem($text, $route, array $parameters = array(), $referenceType = RouterInterface::ABSOLUTE_PATH, array $translationParameters = array()) + public function prependRouteItem($text, $route, array $parameters = array(), $referenceType = RouterInterface::ABSOLUTE_PATH, array $translationParameters = array(), $translate = true) { - return $this->prependNamespaceRouteItem(self::DEFAULT_NAMESPACE, $text, $route, $parameters, $referenceType, $translationParameters); + return $this->prependNamespaceRouteItem(self::DEFAULT_NAMESPACE, $text, $route, $parameters, $referenceType, $translationParameters, $translate); } - public function prependNamespaceRouteItem($namespace, $text, $route, array $parameters = array(), $referenceType = RouterInterface::ABSOLUTE_PATH, array $translationParameters = array()) + public function prependNamespaceRouteItem($namespace, $text, $route, array $parameters = array(), $referenceType = RouterInterface::ABSOLUTE_PATH, array $translationParameters = array(), $translate = true) { $url = $this->router->generate($route, $parameters, $referenceType); - return $this->prependNamespaceItem($namespace, $text, $url, $translationParameters); + return $this->prependNamespaceItem($namespace, $text, $url, $translationParameters, $translate); } - public function addObjectArray(array $objects, $text, $url = "", array $translationParameters = array()) + public function addObjectArray(array $objects, $text, $url = "", array $translationParameters = array(), $translate = true) { - return $this->addNamespaceObjectArray(self::DEFAULT_NAMESPACE, $objects, $text, $url, $translationParameters); + return $this->addNamespaceObjectArray(self::DEFAULT_NAMESPACE, $objects, $text, $url, $translationParameters, $translate); } - public function addNamespaceObjectArray($namespace, array $objects, $text, $url = "", array $translationParameters = array()) + public function addNamespaceObjectArray($namespace, array $objects, $text, $url = "", array $translationParameters = array(), $translate = true) { foreach($objects as $object) { $itemText = $this->validateArgument($object, $text); @@ -81,7 +81,7 @@ public function addNamespaceObjectArray($namespace, array $objects, $text, $url } else { $itemUrl = ""; } - $this->addNamespaceItem($namespace, $itemText, $itemUrl, $translationParameters); + $this->addNamespaceItem($namespace, $itemText, $itemUrl, $translationParameters, $translate); } return $this; diff --git a/Model/SingleBreadcrumb.php b/Model/SingleBreadcrumb.php index 1355d37..2508fd6 100644 --- a/Model/SingleBreadcrumb.php +++ b/Model/SingleBreadcrumb.php @@ -7,11 +7,13 @@ class SingleBreadcrumb public $url; public $text; public $translationParameters; + public $translate; - public function __construct($text = "", $url = "", array $translationParameters = array()) + public function __construct($text = "", $url = "", array $translationParameters = array(), $translate = true) { $this->url = $url; $this->text = $text; $this->translationParameters = $translationParameters; + $this->translate = $translate; } } \ No newline at end of file diff --git a/Resources/views/breadcrumbs.html.twig b/Resources/views/breadcrumbs.html.twig index f6a33cb..9e5919f 100644 --- a/Resources/views/breadcrumbs.html.twig +++ b/Resources/views/breadcrumbs.html.twig @@ -4,11 +4,11 @@ {% for b in breadcrumbs %}