66 if (is_array($registered_items)) {
67 $items->merge($registered_items);
74 if (!isset(
$params[
'sort_by'])) {
75 $params[
'sort_by'] =
'priority';
81 $items = $this->events->triggerResults(
'register',
"menu:{$name}:{$entity->type}:{$entity->subtype}",
$params,
$items);
86 $items = $this->events->triggerResults(
'register',
"menu:{$name}:{$annotation->getType()}:{$annotation->getSubtype()}",
$params,
$items);
91 $items = $this->events->triggerResults(
'register',
"menu:{$name}:{$relationship->getType()}:{$relationship->getSubtype()}",
$params,
$items);
113 $builder = new \ElggMenuBuilder($menu->
getItems());
114 $builder->setSelected($selected_menu_item_name);
116 $params[
'menu'] = $builder->getMenu($sort_by);
117 $params[
'selected_item'] = $builder->getSelected();
122 $params[
'menu'] = $this->events->triggerResults(
'prepare',
"menu:{$name}:{$entity->type}:{$entity->subtype}",
$params,
$params[
'menu']);
127 $params[
'menu'] = $this->events->triggerResults(
'prepare',
"menu:{$name}:{$annotation->getType()}:{$annotation->getSubtype()}",
$params,
$params[
'menu']);
132 $params[
'menu'] = $this->events->triggerResults(
'prepare',
"menu:{$name}:{$relationship->getType()}:{$relationship->getSubtype()}",
$params,
$params[
'menu']);
155 if (
elgg_extract(
'prepare_vertical', $params) !==
true) {
159 $prepare =
function(
\ElggMenuItem $menu_item) use (&$prepare) {
160 $child_menu_vars = $menu_item->getChildMenuOptions();
161 if (empty($child_menu_vars[
'display'])) {
162 $child_menu_vars[
'display'] =
'toggle';
165 $menu_item->setChildMenuOptions($child_menu_vars);
167 foreach ($menu_item->getChildren() as $child_menu_item) {
168 $prepare($child_menu_item);
175 foreach ($section as $menu_item) {
176 $prepare($menu_item);
192 $selected_item =
elgg_extract(
'selected_item', $params);
197 $parent = $selected_item->getParent();
198 while ($parent instanceof \ElggMenuItem) {
199 $parent->setSelected();
200 $parent->addItemClass(
'elgg-has-selected-child');
201 $parent = $parent->getParent();
216 if (
elgg_extract(
'prepare_dropdown', $params) !==
true) {
228 'name' =>
'entity-menu-toggle',
229 'icon' =>
'ellipsis-v',
234 'display' =>
'dropdown',
235 'data-position' => json_encode([
236 'at' =>
'right bottom',
238 'collision' =>
'fit fit',
240 'class' =>
"elgg-{$menu_name}-dropdown-menu",
259 $item_contents_view =
elgg_extract(
'item_contents_view', $params,
'navigation/menu/elements/item/url');
261 $prepare =
function(
\ElggMenuItem $menu_item) use (&$prepare, $item_contents_view) {
262 if (!$menu_item->hasItemContentsView()) {
263 $menu_item->setItemContentsView($item_contents_view);
266 foreach ($menu_item->getChildren() as $child_menu_item) {
267 $prepare($child_menu_item);
274 foreach ($section as $menu_item) {
275 $prepare($menu_item);
296 $new_name =
implode(
'__', $names);
301 foreach ($names as
$name) {
308 $item->setSection($name);
311 $item->setData(
'menu_name', $name);
313 $all_items->add($item);
333 if (is_array($item)) {
342 $prepared_items->add($item);
345 return $prepared_items;
358 $this->menus[$menu_name][] = $menu_item;
371 if (!isset($this->menus[$menu_name])) {
375 foreach ($this->menus[$menu_name] as
$index => $menu_item) {
376 if ($menu_item->getName() === $item_name) {
378 unset($this->menus[$menu_name][
$index]);
$params
Saves global plugin settings.
if(!$user||!$user->canDelete()) $name
c Accompany it with the information you received as to the offer to distribute corresponding source complete source code means all the source code for all modules it plus any associated interface definition plus the scripts used to control compilation and installation of the executable as a special the source code distributed need not include anything that is normally and so on of the operating system on which the executable unless that component itself accompanies the executable If distribution of executable or object code is made by offering access to copy from a designated then offering equivalent access to copy the source code from the same place counts as distribution of the source even though third parties are not compelled to copy the source along with the object code You may not or distribute the Program except as expressly provided under this License Any attempt otherwise to sublicense or distribute the Program is void
elgg_echo(string $message_key, array $args=[], string $language= '')
Elgg language module Functions to manage language and translations.
$relationship
Elgg default relationship view.
elgg_extract($key, $array, $default=null, bool $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.