PHP Класс Lavary\Menu\Item

Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$attributes array Attributes of menu item
$divider array Item's seprator from the rest of the items, if it has any.
$isActive boolean Flag for active state
$nickname string Item's title in camelCase
$title string Item's title

Защищенные свойства (Protected)

Свойство Тип Описание
$builder Lavary\Menu\Menu Reference to the menu builder
$data array Extra information attached to the menu item
$id integer The ID of the menu item
$parent integer Parent Id of the menu item

Открытые методы

Метод Описание
__construct ( Menu $builder, $id, string $title, $options ) : void Creates a new Lavary\Menu\MenuItem instance.
__get ( $prop ) : string Search in meta data if a property doesn't exist otherwise return the property
activate ( Item $item = null ) Activat the item
active ( $pattern = null ) : Lavary\Menu\Item Make the item active
add ( string $title, string | array $options = '' ) : void Creates a sub Item
all ( ) : Lavary\Menu\Collection Returns all childeren of the item
append ( $html ) : Lavary\Menu\Item Appends text or html to the item
attr ( ) : string | Lavary\Menu\Item Add attributes to the item
cascade_data ( array $args = [] ) Cascade data to children
checkActivationStatus ( ) Decide if the item should be active
children ( ) : Lavary\Menu\Collection Returns childeren of the item
data ( ) : string | Lavary\Menu\Item Set or get items's meta data
divide ( array $attributes = [] ) : void Insert a seprator after the item
group ( array $attributes, callable $closure ) : void Group children of the item
hasChildren ( ) : boolean Checks if the item has any children
hasProperty ( String $property ) : boolean Check if propery exists either in the class or the meta collection
id ( mixed $id = null ) : /Lavary/Menu/Item Set id for the item manually
nickname ( string $nickname = null ) : /Lavary/Menu/Item Set nickname for the item manually
prepend ( $html ) : Lavary\Menu\Item Prepends text or html to the item
raw ( $title, array $options = [] ) : Lavary\Menu\Item Add a plain text item
url ( ) : string Generate URL for link

Описание методов

__construct() публичный Метод

Creates a new Lavary\Menu\MenuItem instance.
public __construct ( Menu $builder, $id, string $title, $options ) : void
$builder Menu
$title string
Результат void

__get() публичный Метод

Search in meta data if a property doesn't exist otherwise return the property
public __get ( $prop ) : string
Результат string

activate() публичный Метод

Activat the item
public activate ( Item $item = null )
$item Item

active() публичный Метод

Make the item active
public active ( $pattern = null ) : Lavary\Menu\Item
Результат Lavary\Menu\Item

add() публичный Метод

Creates a sub Item
public add ( string $title, string | array $options = '' ) : void
$title string
$options string | array
Результат void

all() публичный Метод

Returns all childeren of the item
public all ( ) : Lavary\Menu\Collection
Результат Lavary\Menu\Collection

append() публичный Метод

Appends text or html to the item
public append ( $html ) : Lavary\Menu\Item
Результат Lavary\Menu\Item

attr() публичный Метод

Add attributes to the item
public attr ( ) : string | Lavary\Menu\Item
Результат string | Lavary\Menu\Item

cascade_data() публичный Метод

Cascade data to children
public cascade_data ( array $args = [] )
$args array

checkActivationStatus() публичный Метод

Decide if the item should be active

children() публичный Метод

Returns childeren of the item
public children ( ) : Lavary\Menu\Collection
Результат Lavary\Menu\Collection

data() публичный Метод

Set or get items's meta data
public data ( ) : string | Lavary\Menu\Item
Результат string | Lavary\Menu\Item

divide() публичный Метод

Insert a seprator after the item
public divide ( array $attributes = [] ) : void
$attributes array
Результат void

group() публичный Метод

Group children of the item
public group ( array $attributes, callable $closure ) : void
$attributes array
$closure callable
Результат void

hasChildren() публичный Метод

Checks if the item has any children
public hasChildren ( ) : boolean
Результат boolean

hasProperty() публичный Метод

Check if propery exists either in the class or the meta collection
public hasProperty ( String $property ) : boolean
$property String
Результат boolean

id() публичный Метод

Set id for the item manually
public id ( mixed $id = null ) : /Lavary/Menu/Item
$id mixed
Результат /Lavary/Menu/Item

nickname() публичный Метод

Set nickname for the item manually
public nickname ( string $nickname = null ) : /Lavary/Menu/Item
$nickname string
Результат /Lavary/Menu/Item

prepend() публичный Метод

Prepends text or html to the item
public prepend ( $html ) : Lavary\Menu\Item
Результат Lavary\Menu\Item

raw() публичный Метод

Add a plain text item
public raw ( $title, array $options = [] ) : Lavary\Menu\Item
$options array
Результат Lavary\Menu\Item

url() публичный Метод

Generate URL for link
public url ( ) : string
Результат string

Описание свойств

$attributes публичное свойство

Attributes of menu item
public array $attributes
Результат array

$builder защищенное свойство

Reference to the menu builder
protected Lavary\Menu\Menu $builder
Результат Lavary\Menu\Menu

$data защищенное свойство

Extra information attached to the menu item
protected array $data
Результат array

$divider публичное свойство

Item's seprator from the rest of the items, if it has any.
public array $divider
Результат array

$id защищенное свойство

The ID of the menu item
protected int $id
Результат integer

$isActive публичное свойство

Flag for active state
public bool $isActive
Результат boolean

$nickname публичное свойство

Item's title in camelCase
public string $nickname
Результат string

$parent защищенное свойство

Parent Id of the menu item
protected int $parent
Результат integer

$title публичное свойство

Item's title
public string $title
Результат string