Skip to content

Commit

Permalink
Locale and Currency menu shouldnt be renderd when only 1 exists
Browse files Browse the repository at this point in the history
  • Loading branch information
pix-art committed Feb 24, 2015
1 parent e8cd173 commit 2ebfd4c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/Sylius/Bundle/WebBundle/Menu/FrontendMenuBuilder.php
Expand Up @@ -187,13 +187,20 @@ public function createMainMenu()
*/
public function createCurrencyMenu()
{
$currencies = $this->currencyProvider->getAvailableCurrencies();
$menu = $this->factory->createItem('root', array(
'childrenAttributes' => array(
'class' => 'nav nav-pills'
)
));

foreach ($this->currencyProvider->getAvailableCurrencies() as $currency) {
if (1 === count($currencies)) {
$menu->setDisplay(false);

return $menu;
}

foreach ($currencies as $currency) {
$code = $currency->getCode();

$menu->addChild($code, array(
Expand Down
9 changes: 8 additions & 1 deletion src/Sylius/Bundle/WebBundle/Menu/LocaleMenuBuilder.php
Expand Up @@ -61,13 +61,20 @@ public function __construct(
*/
public function createMenu()
{
$locales = $this->localeProvider->getAvailableLocales();
$menu = $this->factory->createItem('root', array(
'childrenAttributes' => array(
'class' => 'nav nav-pills'
)
));

foreach ($this->localeProvider->getAvailableLocales() as $locale) {
if (1 === count($locales)) {
$menu->setDisplay(false);

return $menu;
}

foreach ($locales as $locale) {
$code = $locale->getCode();

$menu->addChild($code, array(
Expand Down

0 comments on commit 2ebfd4c

Please sign in to comment.