2017 © Pedro Peláez
 

yii2-extension yii2-megamenu

Configurable site map with auto generate page title, breadcrumbs and navigation

image

extpoint/yii2-megamenu

Configurable site map with auto generate page title, breadcrumbs and navigation

  • Thursday, July 19, 2018
  • by Vladimir Kozhin
  • Repository
  • 8 Watchers
  • 32 Stars
  • 607 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 5 Forks
  • 0 Open issues
  • 32 Versions
  • 10 % Grown

The README.md

yii2-megamenu

Configurable site map with auto generate page title, breadcrumbs and navigation., (*1)

Install

Install by composer:, (*2)

$ composer require ExtPoint/yii2-megamenu

After install, add MegaMenu to configuration:, (*3)

...
'bootstrap' => ['log', 'megamenu'],
...
'components' => [
    'megaMenu'=> [
        'class' => '\extpoint\megamenu\MegaMenu',
        'items' => [
            // sitemap
        ],
    ],
    ...
],

Features

  • Auto generate page title, breadcrumbs, menus and navigation from site map configuration;
  • Auto check access for actions (not implemented now) and menu item visible;
  • Separate rules from UrlManager to modules.

API of component \extpoint\megamenu\MegaMenu

  • setItems(array $items) Add menu items to end of list;
  • addItems() Add tree menu items;
  • getItems() Get all tree menu items;
  • getActiveItem() Returned item with current route and parsed params. Alias \Yii::$app->requestedRoute, but also have params;
  • getMenu($fromItem = null, $custom = null) Recursive find menu item by param $item (set null for return root) and return tree menu items (in format for \yii\bootstrap\Nav::items). Set param $custom as integer for limit tree levels. For example, getMenu(null, 2) return two-level menu;
  • getTitle($url = null) Find item by url (ot current page) label and return it;
  • getFullTitle($url = null, $separator = ' — ') Find item by url (or current page) and return item label with all parent labels;
  • getBreadcrumbs($url = null) Return breadcrumbs links for widget \yii\widgets\Breadcrumbs;
  • getItem($item, &$parents = []) Find menu item by item url or route. In param $parents will be added all parent items;
  • getItemUrl($item) Find item by url or route and return it url.

API of Menu Item (class \extpoint\megamenu\MegaMenuItem)

Menu item looks like to item from \yii\bootstrap\Nav::items. Next properties is identical:, (*4)

  • label
  • url
  • visible
  • encode
  • items
  • linkOptions
  • active

Additional properties:, (*5)

  • urlRule (string, array or \yii\rest\UrlRule instance) Value format is identical to item from \yii\web\UrlManager::rules;
  • roles (string or array of strings) Value format is identical to \yii\filters\AccessRule::roles. "?", "@" and string role are supported.
  • order (integer or float) Each menu items sorted by order param. Default is zero.
  • redirectToChild (boolean, string or integer) Set true or child item id for use link from this item.

Each items will be equals with search item (or url/route) by method \extpoint\megamenu\MegaMenu::isUrlEquals. Links are equals as two strings. Routes are equals will be normalized to full route (with controller and module), then routes equals as strings. If routes is equals, then checked url params (if it exists). If param value is null, then compared only it keys. If param value is not null, then compared keys and params values., (*6)

Examples:, (*7)

isUrlEquals('http://google.com', 'http://google.com') // true
isUrlEquals(['/qq/ww/ee'], ['/aa/bb/cc']) // false
isUrlEquals(['/aa/bb/cc', 'foo' => null], ['/aa/bb/cc']) // false
isUrlEquals(['/aa/bb/cc', 'foo' => null], ['/aa/bb/cc', 'foo' => null]) // true
isUrlEquals(['/aa/bb/cc', 'foo' => 'qwe'], ['/aa/bb/cc', 'foo' => null]) // true
isUrlEquals(['/aa/bb/cc', 'foo' => 'qwe'], ['/aa/bb/cc', 'foo' => '555']) // false

The Versions

19/07 2018

dev-master

9999999-dev

Configurable site map with auto generate page title, breadcrumbs and navigation

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kozhin Vladimir

yii2 navigation menu breadcrumbs

19/07 2018

1.7.0

1.7.0.0

Configurable site map with auto generate page title, breadcrumbs and navigation

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kozhin Vladimir

yii2 navigation menu breadcrumbs

25/01 2018

1.6.6

1.6.6.0

Configurable site map with auto generate page title, breadcrumbs and navigation

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kozhin Vladimir

yii2 navigation menu breadcrumbs

25/01 2018

1.6.5

1.6.5.0

Configurable site map with auto generate page title, breadcrumbs and navigation

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kozhin Vladimir

yii2 navigation menu breadcrumbs

25/01 2018

1.6.4

1.6.4.0

Configurable site map with auto generate page title, breadcrumbs and navigation

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kozhin Vladimir

yii2 navigation menu breadcrumbs

28/12 2017

1.6.3

1.6.3.0

Configurable site map with auto generate page title, breadcrumbs and navigation

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kozhin Vladimir

yii2 navigation menu breadcrumbs

22/12 2017

1.6.2

1.6.2.0

Configurable site map with auto generate page title, breadcrumbs and navigation

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kozhin Vladimir

yii2 navigation menu breadcrumbs

15/12 2017

1.6.1

1.6.1.0

Configurable site map with auto generate page title, breadcrumbs and navigation

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kozhin Vladimir

yii2 navigation menu breadcrumbs

15/12 2017

1.6.0

1.6.0.0

Configurable site map with auto generate page title, breadcrumbs and navigation

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kozhin Vladimir

yii2 navigation menu breadcrumbs

24/10 2017

1.5.5

1.5.5.0

Configurable site map with auto generate page title, breadcrumbs and navigation

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kozhin Vladimir

yii2 navigation menu breadcrumbs

03/07 2017

1.5.4

1.5.4.0

Configurable site map with auto generate page title, breadcrumbs and navigation

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kozhin Vladimir

yii2 navigation menu breadcrumbs

05/06 2017

1.5.3

1.5.3.0

Configurable site map with auto generate page title, breadcrumbs and navigation

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kozhin Vladimir

yii2 navigation menu breadcrumbs

02/05 2017

1.5.2

1.5.2.0

Configurable site map with auto generate page title, breadcrumbs and navigation

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kozhin Vladimir

yii2 navigation menu breadcrumbs

27/04 2017

1.5.1

1.5.1.0

Configurable site map with auto generate page title, breadcrumbs and navigation

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kozhin Vladimir

yii2 navigation menu breadcrumbs

12/04 2017

1.5.0

1.5.0.0

Configurable site map with auto generate page title, breadcrumbs and navigation

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kozhin Vladimir

yii2 navigation menu breadcrumbs

11/04 2017

1.4.3

1.4.3.0

Configurable site map with auto generate page title, breadcrumbs and navigation

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kozhin Vladimir

yii2 navigation menu breadcrumbs

11/04 2017

1.4.2

1.4.2.0

Configurable site map with auto generate page title, breadcrumbs and navigation

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kozhin Vladimir

yii2 navigation menu breadcrumbs

06/04 2017

1.4.1

1.4.1.0

Configurable site map with auto generate page title, breadcrumbs and navigation

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kozhin Vladimir

yii2 navigation menu breadcrumbs

04/04 2017

1.4.0

1.4.0.0

Configurable site map with auto generate page title, breadcrumbs and navigation

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kozhin Vladimir

yii2 navigation menu breadcrumbs

24/03 2017

1.3.1

1.3.1.0

Configurable site map with auto generate page title, breadcrumbs and navigation

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kozhin Vladimir

yii2 navigation menu breadcrumbs

24/03 2017

1.3.0

1.3.0.0

Configurable site map with auto generate page title, breadcrumbs and navigation

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kozhin Vladimir

yii2 navigation menu breadcrumbs

21/12 2016

1.2.1

1.2.1.0

Configurable site map with auto generate page title, breadcrumbs and navigation

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kozhin Vladimir

yii2 navigation menu breadcrumbs

20/12 2016

1.2.0

1.2.0.0

Configurable site map with auto generate page title, breadcrumbs and navigation

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kozhin Vladimir

yii2 navigation menu breadcrumbs

06/09 2016

1.1.6

1.1.6.0

Configurable site map with auto generate page title, breadcrumbs and navigation

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kozhin Vladimir

yii2 navigation menu breadcrumbs

06/09 2016

1.1.5

1.1.5.0

Configurable site map with auto generate page title, breadcrumbs and navigation

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kozhin Vladimir

yii2 navigation menu breadcrumbs

31/08 2016

1.1.4

1.1.4.0

Configurable site map with auto generate page title, breadcrumbs and navigation

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kozhin Vladimir

yii2 navigation menu breadcrumbs

26/08 2016

1.1.3

1.1.3.0

Configurable site map with auto generate page title, breadcrumbs and navigation

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kozhin Vladimir

yii2 navigation menu breadcrumbs

26/08 2016

1.1.2

1.1.2.0

Configurable site map with auto generate page title, breadcrumbs and navigation

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kozhin Vladimir

yii2 navigation menu breadcrumbs

09/06 2016

1.1.1

1.1.1.0

Configurable site map with auto generate page title, breadcrumbs and navigation

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kozhin Vladimir

yii2 navigation menu breadcrumbs

09/06 2016

1.1.0

1.1.0.0

Configurable site map with auto generate page title, breadcrumbs and navigation

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kozhin Vladimir

yii2 navigation menu breadcrumbs

23/05 2016

1.0.1

1.0.1.0

Configurable site map with auto generate page title, breadcrumbs and navigation

  Sources   Download

MIT

The Requires

 

by Kozhin Vladimir

yii2 navigation menu breadcrumbs

22/05 2016

1.0.0

1.0.0.0

Configurable site map with auto generate page title, breadcrumbs and navigation

  Sources   Download

MIT

The Requires

 

by Kozhin Vladimir

yii2 navigation menu breadcrumbs