Skip to content

Commit

Permalink
chore: no longer use deprecated layout
Browse files Browse the repository at this point in the history
  • Loading branch information
jeabakker committed Apr 23, 2020
1 parent 719da2d commit 21ec589
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions views/default/resources/quicklinks/add.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,26 @@
* add a new QuickLink
*/

elgg_gatekeeper();
use Elgg\EntityNotFoundException;

$page_owner = elgg_get_page_owner_entity();
if (!($page_owner instanceof ElggUser)) {
register_error(elgg_echo('pageownerunavailable', [elgg_get_page_owner_guid()]));
forward(REFERER);
if (!$page_owner instanceof ElggUser) {
throw new EntityNotFoundException(elgg_echo('pageownerunavailable', [elgg_get_page_owner_guid()]));
}

// build page elements
$title_text = elgg_echo('quicklinks:add:title');

$content = elgg_view_form('quicklinks/edit', [], ['container' => $page_owner]);

// draw page
if (elgg_is_xhr()) {
// light version for lightbox
echo elgg_view_module('inline', $title_text, $content);
} else {
// build page
$page_data = elgg_view_layout('content', [
'title' => $title_text,
'content' => $content,
'filter' => '',
]);

// draw page
echo elgg_view_page($title_text, $page_data);
return;
}

// full page
echo elgg_view_page($title_text, [
'content' => $content,
]);

0 comments on commit 21ec589

Please sign in to comment.