Class humhub\widgets\BaseMenu

Inheritancehumhub\widgets\BaseMenu » yii\base\Widget
Subclasseshumhub\modules\admin\widgets\AdminMenu, humhub\modules\admin\widgets\AdvancedSettingMenu, humhub\modules\admin\widgets\AuthenticationMenu, humhub\modules\admin\widgets\GroupManagerMenu, humhub\modules\admin\widgets\GroupMenu, humhub\modules\admin\widgets\InformationMenu, humhub\modules\admin\widgets\SettingsMenu, humhub\modules\admin\widgets\SpaceMenu, humhub\modules\admin\widgets\UserMenu, humhub\modules\admin\widgets\UserSettingMenu, humhub\modules\directory\widgets\Menu, humhub\modules\friendship\widgets\ManageMenu, humhub\modules\space\modules\manage\widgets\DefaultMenu, humhub\modules\space\modules\manage\widgets\MemberMenu, humhub\modules\space\modules\manage\widgets\Menu, humhub\modules\space\modules\manage\widgets\SecurityTabMenu, humhub\modules\space\widgets\AdminMenu, humhub\modules\space\widgets\HeaderControlsMenu, humhub\modules\space\widgets\Menu, humhub\modules\user\widgets\AccountMenu, humhub\modules\user\widgets\AccountProfilMenu, humhub\modules\user\widgets\AccountSettingsMenu, humhub\modules\user\widgets\AccountTopMenu, humhub\modules\user\widgets\ProfileMenu, humhub\widgets\FooterMenu, humhub\widgets\TopMenu

BaseMenu is the base class for navigations.

Public Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$id string Dom element id humhub\widgets\BaseMenu
$itemGroups array Of item groups humhub\widgets\BaseMenu
$items array Of items humhub\widgets\BaseMenu
$template string Template file humhub\widgets\BaseMenu
$type string Type of the navigation, optional for identifing. humhub\widgets\BaseMenu

Public Methods

Hide inherited methods

MethodDescriptionDefined By
addItem() Adds new Item to the menu humhub\widgets\BaseMenu
addItemGroup() Adds new Item Group to the menu humhub\widgets\BaseMenu
deleteItemByUrl() Removes Item by URL humhub\widgets\BaseMenu
getActive() humhub\widgets\BaseMenu
getItemGroups() Returns all Item Groups humhub\widgets\BaseMenu
getItems() Returns Items of this Navigation humhub\widgets\BaseMenu
init() Initializes the navigation widget. humhub\widgets\BaseMenu
markAsActive() Add the active class from a menue item. humhub\widgets\BaseMenu
markAsInactive() Remove the active class from a menue item. humhub\widgets\BaseMenu
run() Executes the Menu Widget humhub\widgets\BaseMenu
setActive() Activates the menu item with the given url humhub\widgets\BaseMenu
setInactive() humhub\widgets\BaseMenu
setViewState() This function is used in combination with pjax to get sure the required menu is active humhub\widgets\BaseMenu

Constants

Hide inherited constants

ConstantValueDescriptionDefined By
EVENT_INIT 'init' humhub\widgets\BaseMenu
EVENT_RUN 'run' humhub\widgets\BaseMenu

Property Details

$id public property (available since version 1.2)

Dom element id

public string $id null
$itemGroups public property

Of item groups

public array $itemGroups = []
$items public property

Of items

public array $items = []
$template public property

Template file

public string $template null
$type public property

Type of the navigation, optional for identifing.

public string $type ''

Method Details

addItem() public method

Adds new Item to the menu

public void addItem ( $item )
$item array

With item definitions

addItemGroup() public method

Adds new Item Group to the menu

public void addItemGroup ( $itemGroup )
$itemGroup array

With group definition

deleteItemByUrl() public method

Removes Item by URL

public void deleteItemByUrl ( $url )
$url string
getActive() public method

public void getActive ( )
getItemGroups() public method

Returns all Item Groups

public array getItemGroups ( )
return array

Of item group definitions

getItems() public method

Returns Items of this Navigation

public array getItems ( $group '' )
$group string

Limits the items to a specified group

return array

A list of items with definition

init() public method

Initializes the navigation widget.

This method mainly normalizes the {@link items} property. If this method is overridden, make sure the parent implementation is invoked.

public void init ( )
markAsActive() public static method

Add the active class from a menue item.

public static void markAsActive ( $url )
$url string

The URL of the item to mark. You can use Url::toRoute(...) to generate it.

markAsInactive() public static method

Remove the active class from a menue item.

public static void markAsInactive ( $url )
$url string

The URL of the item to mark. You can use Url::toRoute(...) to generate it.

run() public method

Executes the Menu Widget

public void run ( )
setActive() public method

Activates the menu item with the given url

public void setActive ( $url )
$url \humhub\widgets\type
setInactive() public method

public void setInactive ( $url )
$url
setViewState() public static method

This function is used in combination with pjax to get sure the required menu is active

public static void setViewState ( )