Elgg
Version 6.1
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
engine
classes
Elgg
Menu
UnpreparedMenu.php
Go to the documentation of this file.
1
<?php
2
3
namespace
Elgg\Menu
;
4
5
use
Elgg\Exceptions\InvalidArgumentException
;
6
12
class
UnpreparedMenu
{
13
17
private
$items;
18
22
private
$params;
23
31
public
function
__construct
(array $params, $items) {
32
$this->params = $params;
33
34
if
(is_array($items)) {
35
$items =
new
MenuItems
($items);
36
}
37
38
if
(!$items instanceof
MenuItems
) {
39
throw
new
InvalidArgumentException
(
'Items collection must implement '
. MenuItems::class);
40
}
41
42
$this->items = $items;
43
}
44
54
public
function
setSortBy
($sort_by =
'text'
) {
55
$this->params[
'sort_by'
] = $sort_by;
56
}
57
66
public
function
getSortBy
() {
67
return
elgg_extract
(
'sort_by'
, $this->params,
'priority'
);
68
}
69
75
public
function
getName
() {
76
return
$this->params[
'name'
];
77
}
78
84
public
function
getItems
() {
85
return
$this->items;
86
}
87
93
public
function
getParams
() {
94
return
$this->params;
95
}
96
}
Elgg\Exceptions\InvalidArgumentException
Exception thrown if an argument is not of the expected type.
Definition:
InvalidArgumentException.php:11
Elgg\Menu\UnpreparedMenu\getSortBy
getSortBy()
Get the designated (or default) sort strategy.
Definition:
UnpreparedMenu.php:66
Elgg\Menu
Definition:
Menu.php:3
elgg_extract
elgg_extract($key, $array, $default=null, bool $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition:
elgglib.php:256
Elgg\Menu\UnpreparedMenu\getParams
getParams()
Get the menu parameters.
Definition:
UnpreparedMenu.php:93
Elgg\Menu\UnpreparedMenu\setSortBy
setSortBy($sort_by= 'text')
Set how this menu should be sorted.
Definition:
UnpreparedMenu.php:54
Elgg\Menu\UnpreparedMenu
Linear set of menu items collected from configuration and the "register" event.
Definition:
UnpreparedMenu.php:12
Elgg\Menu\UnpreparedMenu\getName
getName()
Get the menu name.
Definition:
UnpreparedMenu.php:75
InvalidArgumentException
Elgg\Menu\UnpreparedMenu\__construct
__construct(array $params, $items)
Constructor.
Definition:
UnpreparedMenu.php:31
Elgg\Menu\UnpreparedMenu\getItems
getItems()
Get the menu items.
Definition:
UnpreparedMenu.php:84
Elgg\Menu\MenuItems
A collection of menu items.
Definition:
MenuItems.php:10
Generated on Sat Dec 14 2024 00:00:24 for Elgg by
1.8.11