Methods summary
public
|
#
__construct( string $items = array(), array $name = null, string $attributes = array(), $element = null )
Create a new Item List instance
Create a new Item List instance
Parameters
- $items
- $name The ItemList's name
- $name
- $attributes Attributes for the ItemList's HMTL element
- $attributes
- $element The HTML element for the ItemList
- $element
|
public
Menu\Items\Item
|
#
onItem( )
Get the last Item
Returns
|
public
Menu\Traits\MenuObject
|
#
setOption( string $option, mixed $value )
Set a particular option in the array
Set a particular option in the array
Parameters
- $option
- The option
- $value
- Its new value
Returns
Overrides
|
public
Menu\Items\ItemList
|
#
add( string $url, string $value, Menu\Items\ItemList $children = null, array $linkAttributes = array(), array $itemAttributes = array(), string $itemElement = null, string $beforeContent = null, string $afterContent = null )
Add a link item to the ItemList instance.
Add a link item to the ItemList instance.
Menu::add('home', 'Homepage');
Menu::add('home', 'Homepage', Menu::items()->add('home/sub', 'Subitem'));
Menu::add('home', 'Homepage', null, array('class' => 'fancy'));
Parameters
- $url
- Url of the link
- $value
- (H)T(ML) inside of the link
- $children
- Children
- $linkAttributes
- Attributes for the link
- $itemAttributes
- Attributes for the item
- $itemElement
- The element for the item
- $beforeContent
- String to add before the link
- $afterContent
- String to add after the link
Returns
|
public
Menu\Items\ItemList
|
#
raw( string $raw, Menu\Items\ItemList $children = null, array $itemAttributes = array(), string $itemElement = null, string $beforeContent = null, string $afterContent = null )
Add a raw html item to the ItemList instance.
Add a raw html item to the ItemList instance.
Menu::raw('<img src="img/seperator.gif">');
Parameters
- $raw
- The raw content
- $children
- Children
- $itemAttributes
- The item attributes
- $itemElement
- The item element
- $beforeContent
- String to add before the raw content
- $afterContent
- String to add after the raw content
Returns
|
public
|
#
addContent( Content $content, Menu\Items\ItemList $children = null, array $itemAttributes = array(), string $itemElement = null, string $beforeContent = null, string $afterContent = null )
Add content to the ItemList
Add content to the ItemList
Parameters
- $content
- Content object
- $children
- Children
- $itemAttributes
- Attributes for the item (li)
- $itemElement
- Element for the item (li is default)
- $beforeContent
- String to add before the content
- $afterContent
- String to add after the content
|
public
Menu\Items\ItemList
|
#
activePattern( string $pattern )
Add an active pattern to the ItemList instance.
Add an active pattern to the ItemList instance.
Menu::add('user', 'Users')->activePattern('\/user\/\d\/edit');
Parameters
Returns
|
public
Menu\Items\ItemList
|
#
attach( Menu\Items\ItemList $itemList )
Add menu items to another ItemList.
Add menu items to another ItemList.
Menu::attach(Menu::items()->add('home', 'Homepage'));
Parameters
Returns
|
public
Menu\Items\ItemList
|
#
name( string $name )
Set the name for this ItemList
Set the name for this ItemList
Parameters
Returns
|
public
string
|
#
getName( )
Get the name of the ItemList
Get the name of the ItemList
Returns
string Name of the ItemList
|
public
Menu\Items\ItemList
|
#
prefix( string $prefix )
Prefix this ItemList with a string
Prefix this ItemList with a string
Parameters
Returns
|
public
Menu\Items\ItemList
|
#
prefixParents( boolean $prefixParents = true )
Prefix this ItemList with the parent ItemList(s) name(s)
Prefix this ItemList with the parent ItemList(s) name(s)
Parameters
Returns
|
public
Menu\Items\ItemList
|
#
prefixMenuHandler( boolean $prefixMenuHandler = true )
Prefix this ItemList with the name of the ItemList at the very top of the tree
Prefix this ItemList with the name of the ItemList at the very top of the tree
Parameters
Returns
|
public
|
#
setElement( string $element = null )
Set the Item's element
Parameters
|
public
string
|
|
public
array
|
#
getItemsWithDepth( )
Get all items with the depth as key
Get all items with the depth as key
Returns
array
|
protected
array
|
#
getItemsRecursivelyWithDepth( $items, $depth = 0 )
Get all items for an array of items recursively for a specific depth
Get all items for an array of items recursively for a specific depth
Returns
array
|
public
array
|
#
getItemListsWithDepth( )
Get all itemlists with the depth as key
Get all itemlists with the depth as key
Returns
array
|
protected
array
|
#
getItemListsRecursivelyWithDepth( $itemList, $depth = 0 )
Get all itemlists for an itemlsit recursively for a specific depth
Get all itemlists for an itemlsit recursively for a specific depth
Returns
array
|
public
Vespakoen\Menu\MenuHandler
|
#
getAllItems( )
Get all items
Returns
Vespakoen\Menu\MenuHandler
|
public
VEspakoen\Menu\MenuHandler
|
#
getItemsByContentType( string $contentType )
Get items by their content type
Get items by their content type
Parameters
- $contentType
- The full object name
Returns
VEspakoen\Menu\MenuHandler
|
public
Vespakoen\Menu\MenuHandler
|
|
public
Vespakoen\Menu\MenuHandler
|
|
public
Vespakoen\Menu\MenuHandler
|
#
getItemListsAtDepth( $depth )
Get itemlists at a certain depth
Get itemlists at a certain depth
Returns
Vespakoen\Menu\MenuHandler
|
public
Vespakoen\Menu\MenuHandler
|
#
getItemListsAtDepthRange( $from, $to )
Get itemlists in a range of depths
Get itemlists in a range of depths
Returns
Vespakoen\Menu\MenuHandler
|
public
Vespakoen\Menu\MenuHandler
|
#
getItemsAtDepth( $depth )
Get all items at a certain depth
Get all items at a certain depth
Returns
Vespakoen\Menu\MenuHandler
|
public
Vespakoen\Menu\MenuHandler
|
#
getItemsAtDepthRange( $from, $to )
Get items in a range of depths
Get items in a range of depths
Returns
Vespakoen\Menu\MenuHandler
|
public
|
|
public
|
|
public
|
|
public
|
|
public
Vespakoen\Menu\Items\ItemLists|false
|
#
findItemListByName( $name )
Find an itemlist by it's name
Find an itemlist by it's name
Returns
Vespakoen\Menu\Items\ItemLists|false
|
public
Vespakoen\Menu\Items\ItemLists|false
|
#
findByName( $name )
Find an itemlist by it's name
Find an itemlist by it's name
alias for findItemListByName
Returns
Vespakoen\Menu\Items\ItemLists|false
|
public
Vespakoen\Menu\Items\ItemLists|false
|
#
find( $name )
Find an itemlist by it's name
Find an itemlist by it's name
alias for findItemListByName
Returns
Vespakoen\Menu\Items\ItemLists|false
|
public
Vespakoen\Menu\Items\Item|false
|
#
findItemByAttribute( $key, $value )
Find an item by an attribute
Find an item by an attribute
Returns
Vespakoen\Menu\Items\Item|false
|
public
Vespakoen\Menu\Items\Item|false
|
#
findItemByUrl( $url )
Find an item by it's link's URL
Find an item by it's link's URL
Returns
Vespakoen\Menu\Items\Item|false
|
public
Menu\Items\ItemList
|
#
hydrate( Closure $resolver, Closure $decorator, integer $idField = 'id', integer $parentIdField = 'parent_id', $parentId = 0 )
Easily create items while looping over DB results
that have a reference to the parent (usually via parentId)
Easily create items while looping over DB results
that have a reference to the parent (usually via parentId)
Menu::hydrate(function($parentId)
{
return Page::where('parent_id', $parentId)
->get();
},
function($children, $page)
{
$children->add($page->slug, $page->name);
});
Parameters
- $resolver
- the callback to resolve results for a given parentId
- $decorator
- the callback that modifies the ItemList for the given node
- $idField
- the id column that matches with the parentId
- $parentIdField
- $parentId the parentId to start hydrating from
- $parentId
Returns
|
public
string
|
#
render( integer $depth = 0 )
Get the evaluated string content of the ItemList.
Get the evaluated string content of the ItemList.
Parameters
- $depth
- The depth at which the ItemList should be rendered
Returns
string
|