Elgg
Version 6.1
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
engine
classes
Elgg
Menus
EntityTrash.php
Go to the documentation of this file.
1
<?php
2
3
namespace
Elgg\Menus
;
4
5
use
Elgg\Menu\MenuItems
;
6
10
class
EntityTrash
{
11
19
public
static
function
registerRestore
(\
Elgg
\
Event
$event): ?
MenuItems
{
20
$entity
= $event->getEntityParam();
21
if
(!
$entity
->canEdit() || !
$entity
->hasCapability(
'restorable'
) || !
$entity
->isDeleted()) {
22
return
null;
23
}
24
25
/* @var $return MenuItems */
26
$return = $event->getValue();
27
28
$container
=
$entity
->getContainerEntity();
29
if
(
$container
instanceof \
ElggEntity
&& !
$container
->isDeleted()) {
30
$return[] =
\ElggMenuItem::factory
([
31
'name'
=>
'restore'
,
32
'icon'
=>
'trash-restore-alt'
,
33
'text'
=>
elgg_echo
(
'restore:this'
),
34
'href'
=>
elgg_generate_action_url
(
'entity/restore'
, [
35
'guid'
=>
$entity
->guid,
36
]),
37
'confirm'
=>
elgg_echo
(
'restoreconfirm'
),
38
'priority'
=> 900,
39
]);
40
}
else
{
41
$return[] =
\ElggMenuItem::factory
([
42
'name'
=>
'restore_and_move'
,
43
'icon'
=>
'trash-restore-alt'
,
44
'text'
=>
elgg_echo
(
'restore:this:move'
),
45
'title'
=>
elgg_echo
(
'restore:this'
),
46
'href'
=>
elgg_http_add_url_query_elements
(
'ajax/form/entity/chooserestoredestination'
, [
47
'entity_guid'
=>
$entity
->guid,
48
]),
49
'link_class'
=>
'elgg-lightbox'
,
50
'priority'
=> 800,
51
]);
52
}
53
54
return
$return;
55
}
56
}
elgg_generate_action_url
elgg_generate_action_url(string $action, array $query=[], bool $add_csrf_tokens=true)
Generate an action URL.
Definition:
pagehandler.php:197
Elgg\Menus\EntityTrash
Add items to the entity:trash menu.
Definition:
EntityTrash.php:10
elgg_echo
elgg_echo(string $message_key, array $args=[], string $language= '')
Elgg language module Functions to manage language and translations.
Definition:
languages.php:17
ElggMenuItem\factory
static factory(array $options)
Create an ElggMenuItem from an associative array.
Definition:
ElggMenuItem.php:130
Elgg\Menus\EntityTrash\registerRestore
static registerRestore(\Elgg\Event $event)
Register the restore menu item.
Definition:
EntityTrash.php:19
MenuItems
Elgg
Definition:
ActionsService.php:3
$entity
$entity
Definition:
reset.php:8
Elgg\Menus
Definition:
AdminControlPanel.php:3
$container
$container
Definition:
delete.php:23
elgg_http_add_url_query_elements
elgg_http_add_url_query_elements(string $url, array $elements)
Sets elements in a URL's query string.
Definition:
elgglib.php:183
ElggEntity
Definition:
ElggEntity.php:52
Elgg\Menu\MenuItems
A collection of menu items.
Definition:
MenuItems.php:10
Elgg\Event
Models an event passed to event handlers.
Definition:
Event.php:11
Generated on Wed Dec 4 2024 00:00:21 for Elgg by
1.8.11