1 | <?php |
||
2 | /** |
||
3 | * Edit an existing collection |
||
4 | */ |
||
5 | |||
6 | use Elgg\Exceptions\Http\EntityNotFoundException; |
||
7 | use Elgg\Exceptions\Http\EntityPermissionsException; |
||
8 | |||
9 | $collection_id = (int) elgg_extract('collection_id', $vars); |
||
10 | $collection = elgg_get_access_collection($collection_id); |
||
11 | |||
12 | if (!$collection || !$collection->canEdit()) { |
||
13 | throw new EntityPermissionsException(); |
||
14 | } |
||
15 | |||
16 | $user = $collection->getOwnerEntity(); |
||
17 | if (!$user instanceof \ElggUser) { |
||
18 | throw new EntityNotFoundException(); |
||
19 | } |
||
20 | |||
21 | elgg_set_page_owner_guid($user->guid); |
||
22 | |||
23 | elgg_push_breadcrumb(elgg_echo('friends:collections'), elgg_generate_url('collection:access_collection:friends:owner', ['username' => $user->username])); |
||
1 ignored issue
–
show
Bug
introduced
by
Loading history...
|
|||
24 | elgg_push_breadcrumb($collection->getDisplayName(), $collection->getURL()); |
||
25 | |||
26 | echo elgg_view_page(elgg_echo('friends:collections:edit'), [ |
||
27 | 'content' => elgg_view_form('friends/collections/edit', ['sticky_enabled' => true], [ |
||
28 | 'collection_id' => $collection->id, |
||
29 | 'collection_name' => $collection->name, |
||
30 | ]), |
||
31 | 'filter_id' => 'friends_collections/edit', |
||
32 | ]); |
||
33 |