Final Class Yiisoft\Yii\Bulma\Menu
| Inheritance | Yiisoft\Yii\Bulma\Menu » Yiisoft\Widget\Widget |
|---|
The Bulma menu is a vertical navigation component.
Public Methods
| Method | Description | Defined By |
|---|---|---|
| activateParents() | Returns a new instance with the activated parent items. | Yiisoft\Yii\Bulma\Menu |
| activeCssClass() | Returns a new instance with the specified active CSS class. | Yiisoft\Yii\Bulma\Menu |
| attributes() | Returns a new instance with the specified HTML attributes for widget. | Yiisoft\Yii\Bulma\Menu |
| autoIdPrefix() | Returns a new instance with the specified prefix to the automatically generated widget IDs. | Yiisoft\Yii\Bulma\Menu |
| brand() | Returns a new instance with the specified HTML code of brand. | Yiisoft\Yii\Bulma\Menu |
| currentPath() | Returns a new instance with the specified current path. | Yiisoft\Yii\Bulma\Menu |
| deactivateItems() | Returns a new instance with the specified disables active items according to their current path. | Yiisoft\Yii\Bulma\Menu |
| firstItemCssClass() | Returns a new instance with the specified first item CSS class. | Yiisoft\Yii\Bulma\Menu |
| id() | Returns a new instance with the specified ID of the widget. | Yiisoft\Yii\Bulma\Menu |
| itemAttributes() | Returns a new instance with the specified item attributes. | Yiisoft\Yii\Bulma\Menu |
| items() | Returns a new instance with the specified items. | Yiisoft\Yii\Bulma\Menu |
| itemsTag() | Return a new instance with tag for item container. | Yiisoft\Yii\Bulma\Menu |
| labelTemplate() | Returns a new instance with the specified label template. | Yiisoft\Yii\Bulma\Menu |
| lastItemCssClass() | Returns a new instance with the specified last item CSS class. | Yiisoft\Yii\Bulma\Menu |
| render() | Renders the menu. | Yiisoft\Yii\Bulma\Menu |
| subMenuTemplate() | Returns a new instance with the specified the template used to render a list of sub-menus. | Yiisoft\Yii\Bulma\Menu |
| urlTemplate() | Returns a new instance with the specified link template. | Yiisoft\Yii\Bulma\Menu |
Method Details
Returns a new instance with the activated parent items.
Activates parent menu items when one of the corresponding child menu items is active. The activated parent menu items will also have its CSS classes appended with {@see \Yiisoft\Yii\Bulma\activeCssClass()}.
| public self activateParents ( ) |
public function activateParents(): self
{
$new = clone $this;
$new->activateParents = true;
return $new;
}
Returns a new instance with the specified active CSS class.
| public self activeCssClass ( string $value ) | ||
| $value | string |
The CSS class to be appended to the active menu item. |
public function activeCssClass(string $value): self
{
$new = clone $this;
$new->activeCssClass = $value;
return $new;
}
Returns a new instance with the specified HTML attributes for widget.
| public self attributes ( array $values ) | ||
| $values | array |
Attribute values indexed by attribute names. {@see \Yiisoft\Html\Html::renderTagAttributes()} For details on how attributes are being rendered. |
public function attributes(array $values): self
{
$new = clone $this;
$new->attributes = $values;
return $new;
}
Returns a new instance with the specified prefix to the automatically generated widget IDs.
| public self autoIdPrefix ( string $value ) | ||
| $value | string |
The prefix to the automatically generated widget IDs. |
public function autoIdPrefix(string $value): self
{
$new = clone $this;
$new->autoIdPrefix = $value;
return $new;
}
Returns a new instance with the specified HTML code of brand.
| public self brand ( string $value ) | ||
| $value | string |
The HTML code of brand. |
public function brand(string $value): self
{
$new = clone $this;
$new->brand = $value;
return $new;
}
Returns a new instance with the specified current path.
| public self currentPath ( string $value ) | ||
| $value | string |
The current path. |
public function currentPath(string $value): self
{
$new = clone $this;
$new->currentPath = $value;
return $new;
}
Returns a new instance with the specified disables active items according to their current path.
{@see \Yiisoft\Yii\Bulma\isItemActive}
| public self deactivateItems ( ) |
public function deactivateItems(): self
{
$new = clone $this;
$new->activateItems = false;
return $new;
}
Returns a new instance with the specified first item CSS class.
| public self firstItemCssClass ( string $value ) | ||
| $value | string |
The CSS class that will be assigned to the first item in the main menu or each submenu. |
public function firstItemCssClass(string $value): self
{
$new = clone $this;
$new->firstItemCssClass = $value;
return $new;
}
Returns a new instance with the specified ID of the widget.
| public self id ( string $value ) | ||
| $value | string |
The ID of the widget. |
public function id(string $value): self
{
$new = clone $this;
$new->attributes['id'] = $value;
return $new;
}
Returns a new instance with the specified item attributes.
| public self itemAttributes ( array $value ) | ||
| $value | array |
List of HTML attributes shared by all menu {@see \Yiisoft\Yii\Bulma\items}. If any individual menu item
specifies its {@see \Yiisoft\Html\Html::renderTagAttributes() For details on how attributes are being rendered} |
public function itemAttributes(array $value): self
{
$new = clone $this;
$new->itemAttributes = $value;
return $new;
}
Returns a new instance with the specified items.
| public self items ( array $value ) | ||
| $value | array |
List of menu items. Each menu item should be an array of the following structure:
|
public function items(array $value): self
{
$new = clone $this;
$new->items = $value;
return $new;
}
Return a new instance with tag for item container.
| public self itemsTag ( string|null $value ) | ||
| $value | string|null |
The tag for item container, |
public function itemsTag(?string $value): self
{
if ($value === '') {
throw new InvalidArgumentException('Tag for item container cannot be empty.');
}
$new = clone $this;
$new->itemsTag = $value;
return $new;
}
Returns a new instance with the specified label template.
| public self labelTemplate ( string $value ) | ||
| $value | string |
The template used to render the body of a menu which is NOT a link. In this template, the token This property will be overridden by the |
public function labelTemplate(string $value): self
{
$new = clone $this;
$new->labelTemplate = $value;
return $new;
}
Returns a new instance with the specified last item CSS class.
| public self lastItemCssClass ( string $value ) | ||
| $value | string |
The CSS class that will be assigned to the last item in the main menu or each submenu. |
public function lastItemCssClass(string $value): self
{
$new = clone $this;
$new->lastItemCssClass = $value;
return $new;
}
Renders the menu.
| public string render ( ) | ||
| return | string |
The result of Widget execution to be outputted. |
|---|---|---|
| throws | JsonException | |
public function render(): string
{
$items = $this->normalizeItems($this->items);
if (empty($items)) {
return '';
}
return $this->renderMenu($items);
}
Returns a new instance with the specified the template used to render a list of sub-menus.
In this template, the token {items} will be replaced with the rendered sub-menu items.
| public self subMenuTemplate ( string $value ) | ||
| $value | string | |
public function subMenuTemplate(string $value): self
{
$new = clone $this;
$new->subMenuTemplate = $value;
return $new;
}
Returns a new instance with the specified link template.
| public self urlTemplate ( string $value ) | ||
| $value | string |
The template used to render the body of a menu which is a link. In this template, the token
This property will be overridden by the |
public function urlTemplate(string $value): self
{
$new = clone $this;
$new->urlTemplate = $value;
return $new;
}
Signup or Login in order to comment.