Abstract Class humhub\modules\ui\menu\MenuEntry

Inheritancehumhub\modules\ui\menu\MenuEntry » yii\base\BaseObject
Subclasseshumhub\modules\content\widgets\LegacyWallEntryControlLink, humhub\modules\ui\menu\DropdownDivider, humhub\modules\ui\menu\MenuLink, humhub\modules\ui\menu\WidgetMenuEntry
Available since version1.4

Class MenuEntry

An abstract menu entry class. Subclasses need to extend the render() function.

See also humhub\modules\ui\menu\widgets\Menu.

Protected Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$htmlOptions array Additional html options for the link HTML tag humhub\modules\ui\menu\MenuEntry
$id string Menu entry identifier (optional) humhub\modules\ui\menu\MenuEntry
$isActive boolean Mark this entry as active humhub\modules\ui\menu\MenuEntry
$isVisible boolean humhub\modules\ui\menu\MenuEntry
$sortOrder integer The sort order humhub\modules\ui\menu\MenuEntry

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
renderEntry() Renders the entry html, this template function should respect $htmlOptions array by calling getHtmlOptions() and passing the $extraHtmlOptions array as for example: humhub\modules\ui\menu\MenuEntry

Property Details

$htmlOptions protected property

Additional html options for the link HTML tag

protected array $htmlOptions = []
$id protected property

Menu entry identifier (optional)

protected string $id null
$isActive protected property

Mark this entry as active

protected boolean $isActive false
$isVisible protected property
protected boolean $isVisible true
$sortOrder protected property

The sort order

protected integer $sortOrder null

Method Details

compare() public method

Compares this entry with the given entry

public boolean compare ( humhub\modules\ui\menu\MenuEntry $entry )
$entry humhub\modules\ui\menu\MenuEntry
getHtmlOptions() public method

Returns the Html options for the menu entry link tag.

public array getHtmlOptions ( $extraOptions = [] )
$extraOptions
getId() public method

public string getId ( )
return string

The id

getIsActive() public method

public boolean getIsActive ( )
return boolean

Is active

getSortOrder() public method

public integer getSortOrder ( )
isActiveState() public static method

public static void isActiveState ( $moduleId null, $controllerIds = [], $actionIds = [] )
$moduleId
$controllerIds
$actionIds
isVisible() public method

public boolean isVisible ( )
render() public method

Public accessible render function responsible for rendering this entry.

public string render ( $extraHtmlOptions = [] )
$extraHtmlOptions array
renderEntry() protected abstract method

Renders the entry html, this template function should respect $htmlOptions array by calling getHtmlOptions() and passing the $extraHtmlOptions array as for example:


return Html::a($label, $url, $this->getHtmlOptions($extraHtmlOptions));

protected abstract string renderEntry ( $extraHtmlOptions = [] )
$extraHtmlOptions array
return string

The Html link

setHtmlOptions() public method

public static setHtmlOptions ( $htmlOptions )
$htmlOptions array
setId() public method

public static setId ( $id )
$id

String the id

setIsActive() public method

public static setIsActive ( $state )
$state

Boolean

setIsActiveState() public method

Activates this MenuEntry in case the given moduleId, controllerId and actionId matches the current request.

public static setIsActiveState ( $moduleId, $controllerIds = [], $actionIds = [] )
$moduleId string

Controller module id

$controllerIds array|string

Controller id

$actionIds array|string

Action id

setIsVisible() public method

public static setIsVisible ( $isVisible )
$isVisible boolean
setSortOrder() public method

public static setSortOrder ( $sortOrder )
$sortOrder integer