Abstract Class humhub\modules\ui\menu\widgets\Menu

Inheritancehumhub\modules\ui\menu\widgets\Menu » humhub\widgets\JsWidget » humhub\components\Widget » 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\ModuleMenu, humhub\modules\admin\widgets\SettingsMenu, humhub\modules\admin\widgets\SpaceMenu, humhub\modules\admin\widgets\UserMenu, humhub\modules\admin\widgets\UserSettingMenu, humhub\modules\content\widgets\WallEntryControls, 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\HeaderControlsMenu, humhub\modules\space\widgets\Menu, humhub\modules\ui\menu\widgets\DropdownMenu, humhub\modules\ui\menu\widgets\LeftNavigation, humhub\modules\ui\menu\widgets\SubTabMenu, humhub\modules\ui\menu\widgets\TabMenu, humhub\modules\user\widgets\AccountMenu, humhub\modules\user\widgets\AccountProfileMenu, humhub\modules\user\widgets\AccountSettingsMenu, humhub\modules\user\widgets\AccountTopMenu, humhub\modules\user\widgets\ProfileMenu, humhub\widgets\BaseMenu, humhub\widgets\FooterMenu, humhub\widgets\TopMenu
Available since version1.4

Base class for menus and navigations.

Protected Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$entries humhub\modules\ui\menu\MenuEntry[] The menu entries humhub\modules\ui\menu\widgets\Menu

Public Methods

Hide inherited methods

MethodDescriptionDefined By
addEntry() Add new menu entry to the navigation humhub\modules\ui\menu\widgets\Menu
addItem() humhub\modules\ui\menu\widgets\Menu
addItemGroup() humhub\modules\ui\menu\widgets\Menu
deleteItemByUrl() humhub\modules\ui\menu\widgets\Menu
getActive() humhub\modules\ui\menu\widgets\Menu
getActiveEntry() Returns the first active menu entry humhub\modules\ui\menu\widgets\Menu
getData() Returns an array of data-* attributes to configure your clientside js widget. humhub\modules\ui\menu\widgets\Menu
getEntries() Returns all entries filtered by $type. If no $type filter is given all entries are returned. humhub\modules\ui\menu\widgets\Menu
getEntryById() Returns the first entry with the given id humhub\modules\ui\menu\widgets\Menu
getEntryByUrl() Returns the first entry with the given URL humhub\modules\ui\menu\widgets\Menu
getFirstEntry() humhub\modules\ui\menu\widgets\Menu
getId() Returns the html id of this widget, if no id is set this function will generate an id if $autoGenerate is set to true (default). humhub\widgets\JsWidget
getItemGroups() humhub\modules\ui\menu\widgets\Menu
getItems() humhub\modules\ui\menu\widgets\Menu
getLayoutViewParams() Returns an array of view parameter used if \humhub\components\layout is set. humhub\components\Widget
getSortedEntries() Sorts the entry list by sortOrder and returns the sorted entry list. humhub\modules\ui\menu\widgets\Menu
hasMultipleEntries() Checks if this menu contains multiple entries of the given $type, or at all if no $type filter is given. humhub\modules\ui\menu\widgets\Menu
markAsActive() This function provides static menu entry activation, by entry id or url. humhub\modules\ui\menu\widgets\Menu
markAsInactive() This function provides static menu entry inactivation, by entry id or url. humhub\modules\ui\menu\widgets\Menu
process() Process is a wrapper for the run method humhub\components\Widget
removeEntry() Removes the entry from the navigation humhub\modules\ui\menu\widgets\Menu
run() Executes the navigation widget. humhub\modules\ui\menu\widgets\Menu
setActive() Activates an entry by given id or url search string. humhub\modules\ui\menu\widgets\Menu
setDefaultOptions() Sets some default data options required by all widgets as the widget implementation and the widget events and initialization trigger. humhub\widgets\JsWidget
setEntryActive() Sets an menu entry active and inactive all other entries humhub\modules\ui\menu\widgets\Menu
setInactive() humhub\modules\ui\menu\widgets\Menu
setViewState() humhub\modules\ui\menu\widgets\Menu
widget() Creates a widget instance and runs it. humhub\components\Widget

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
getAttributes() Returns all html attributes for used by this widget and will normally inserted in the widgets root html element. humhub\widgets\JsWidget
getOptions() Assembles all widget attributes and data settings of this widget. humhub\widgets\JsWidget
getViewParams() Returns the parameters which are passed to the view template humhub\modules\ui\menu\widgets\Menu

Events

Hide inherited events

EventTypeDescriptionDefined By
EVENT_CREATE humhub\libs\WidgetCreateEvent An event raised before creating a widget. humhub\components\Widget
EVENT_RUN \humhub\modules\ui\menu\widgets\MenuEvent An event raised before running the navigation widget. humhub\modules\ui\menu\widgets\Menu

Property Details

$entries protected property

The menu entries

$template public property

Template view file of the navigation

public string $template null

Method Details

addEntry() public method

Add new menu entry to the navigation

public void addEntry ( humhub\modules\ui\menu\MenuEntry $entry )
$entry humhub\modules\ui\menu\MenuEntry
addItem() public method
Deprecated since 1.4

public void addItem ( $entryArray )
$entryArray array
addItemGroup() public method
Deprecated since 1.4 not longer supported!

public array addItemGroup ( $itemGroup )
$itemGroup
return array

Item group

deleteItemByUrl() public method
Deprecated since 1.4

public void deleteItemByUrl ( $url )
$url

String the URL or route

getActive() public method
Deprecated since 1.4

public array getActive ( )
return array

The menu entry as array

getActiveEntry() public method

Returns the first active menu entry

public humhub\modules\ui\menu\MenuEntry getActiveEntry ( )
getData() public method

Returns an array of data-* attributes to configure your clientside js widget.

Note that this function does not require to add the data- prefix. This will be done by Yii.

The data-* attributes should be inserted to the widgets root element.

public [] getData ( )
getEntries() public method

Returns all entries filtered by $type. If no $type filter is given all entries are returned.

If $filterVisible is set, only visible entries will be returned

public humhub\modules\ui\menu\MenuEntry[] getEntries ( $type null, $filterVisible false )
$type null|string
$filterVisible boolean
getEntryById() public method

Returns the first entry with the given id

public humhub\modules\ui\menu\MenuEntry getEntryById ( $id )
$id

String the menueId

getEntryByUrl() public method

Returns the first entry with the given URL

public humhub\modules\ui\menu\MenuLink getEntryByUrl ( $url )
$url

String|array the url or route

getFirstEntry() public method

public humhub\modules\ui\menu\MenuEntry|null getFirstEntry ( $type null, $filterVisible false )
$type null
$filterVisible boolean
getItemGroups() public method
Deprecated since 1.4

public array getItemGroups ( )
return array

The item group

getItems() public method
Deprecated since 1.4

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

The menu items as array list

getSortedEntries() public method

Sorts the entry list by sortOrder and returns the sorted entry list.

public humhub\modules\ui\menu\MenuEntry[] getSortedEntries ( )
getViewParams() protected method

Returns the parameters which are passed to the view template

protected array getViewParams ( )
return array

The view parameters

hasMultipleEntries() public method

Checks if this menu contains multiple entries of the given $type, or at all if no $type filter is given.

public boolean hasMultipleEntries ( $type null )
$type null
markAsActive() public static method

This function provides static menu entry activation, by entry id or url.

public static void markAsActive ( $searchStr )
$searchStr
markAsInactive() public static method

This function provides static menu entry inactivation, by entry id or url.

public static void markAsInactive ( $url )
$url
removeEntry() public method

Removes the entry from the navigation

public boolean removeEntry ( $entry )
$entry humhub\modules\ui\menu\MenuEntry
run() public method

Executes the navigation widget.

public string run ( )
return string

The result of navigation widget execution to be outputted.

setActive() public method

Activates an entry by given id or url search string.

public void setActive ( $searchStr )
$searchStr

Menu entry id or url

setEntryActive() public method

Sets an menu entry active and inactive all other entries

public void setEntryActive ( humhub\modules\ui\menu\MenuEntry $entry )
$entry humhub\modules\ui\menu\MenuEntry
setInactive() public method
Deprecated since 1.4

public void setInactive ( $searchStr )
$searchStr
setViewState() public static method
Deprecated since 1.4

public static void setViewState ( )

Event Details

EVENT_RUN event of type \humhub\modules\ui\menu\widgets\MenuEvent

An event raised before running the navigation widget.