PHP Class Caffeinated\Menus\Item

Datei anzeigen Open project: caffeinated/menus Class Usage Examples

Public Properties

Property Type Description
$attributes array
$divider array
$id integer
$parent integer
$slug string
$title string

Protected Properties

Property Type Description
$builder Builder
$data array

Public Methods

Method Description
__construct ( Builder $builder, integer $id, string $title, array | string $options ) Constructor.
__get ( string $property ) : string Return either a property or attribute item value.
activate ( Item $item = null )
active ( $pattern = null )
add ( string $title, array | string $options = '' ) : Item Adds a sub item to the menu.
append ( string $html ) : Item Appends HTML to the item.
appendIcon ( ) : string Return the title with the icon appended automatically.
attribute ( array | string $attribute, string $value = null ) : mixed Assign or fetch the desired attribute.
attributes ( ) : string Fetch the formatted attributes for the item in HTML.
builder ( )
can ( $permissions )
canAtLeast ( $permissions )
checkActiveStatus ( ) : null Decide if the item should be active.
children ( ) : Caffeinated\Menus\Collection Returns all children underneath the menu item.
configureLink ( array | string $options ) : null Configures the link for the menu item.
data ( ) : string | Item Set or get an item's metadata.
divide ( array $attributes = [] ) : void Insert a divider after the item.
getAttributes ( ) : array Get all attributes.
hasChildren ( ) : boolean Determines if the menu item has children.
icon ( string $icon, string $type = 'fontawesome' ) : Item Appends the specified icon to the item.
isActive ( ) : boolean Returns bool value if item is active or not.
prepend ( string $html ) : Item Prepends HTML to the item.
prependIcon ( ) : string Return the title with the icon prepended automatically.
url ( ) : string Generates a valid URL for the menu item.

Method Details

__construct() public method

Constructor.
public __construct ( Builder $builder, integer $id, string $title, array | string $options )
$builder Builder
$id integer
$title string
$options array | string

__get() public method

Return either a property or attribute item value.
public __get ( string $property ) : string
$property string
return string

activate() public method

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

active() public method

public active ( $pattern = null )

add() public method

Adds a sub item to the menu.
public add ( string $title, array | string $options = '' ) : Item
$title string
$options array | string
return Item

append() public method

Appends HTML to the item.
public append ( string $html ) : Item
$html string
return Item

appendIcon() public method

Return the title with the icon appended automatically.
public appendIcon ( ) : string
return string

attribute() public method

Assign or fetch the desired attribute.
public attribute ( array | string $attribute, string $value = null ) : mixed
$attribute array | string
$value string
return mixed

attributes() public method

Fetch the formatted attributes for the item in HTML.
public attributes ( ) : string
return string

builder() public method

public builder ( )

can() public method

public can ( $permissions )

canAtLeast() public method

public canAtLeast ( $permissions )

checkActiveStatus() public method

Decide if the item should be active.
public checkActiveStatus ( ) : null
return null

children() public method

Returns all children underneath the menu item.
public children ( ) : Caffeinated\Menus\Collection
return Caffeinated\Menus\Collection

data() public method

Set or get an item's metadata.
public data ( ) : string | Item
return string | Item

divide() public method

Insert a divider after the item.
public divide ( array $attributes = [] ) : void
$attributes array
return void

getAttributes() public method

Get all attributes.
public getAttributes ( ) : array
return array

hasChildren() public method

Determines if the menu item has children.
public hasChildren ( ) : boolean
return boolean

icon() public method

Appends the specified icon to the item.
public icon ( string $icon, string $type = 'fontawesome' ) : Item
$icon string
$type string Can be either "fontawesome" or "glyphicon"
return Item

isActive() public method

Returns bool value if item is active or not.
public isActive ( ) : boolean
return boolean

prepend() public method

Prepends HTML to the item.
public prepend ( string $html ) : Item
$html string
return Item

prependIcon() public method

Return the title with the icon prepended automatically.
public prependIcon ( ) : string
return string

url() public method

Generates a valid URL for the menu item.
public url ( ) : string
return string

Property Details

$attributes public_oe property

public array $attributes
return array

$builder protected_oe property

protected Builder,Caffeinated\Menus $builder
return Builder

$data protected_oe property

protected array $data
return array

$divider public_oe property

public array $divider
return array

$id public_oe property

public int $id
return integer

$parent public_oe property

public int $parent
return integer

$slug public_oe property

public string $slug
return string

$title public_oe property

public string $title
return string