Elgg  Version master
owner_block.php
Go to the documentation of this file.
1 <?php
10 if (!elgg_extract('show_owner_block', $vars, true)) {
11  return;
12 }
13 
15 if (!$owner instanceof \ElggGroup && !$owner instanceof \ElggUser) {
16  return;
17 }
18 
19 $body = '';
20 if (elgg_extract('show_owner_block_menu', $vars, true)) {
21  $menu_params = elgg_extract('owner_block_menu_params', $vars, []);
22  $menu_params['entity'] = $owner;
23  $menu_params['prepare_vertical'] = true;
24 
25  $body .= elgg_view_menu('owner_block', $menu_params);
26 }
27 
28 if (elgg_view_exists('page/elements/owner_block/extend')) {
29  $body .= elgg_view('page/elements/owner_block/extend', $vars);
30 }
31 
32 if (empty($body)) {
33  return;
34 }
35 
36 echo elgg_view_module('aside', '', $body, [
37  'header' => elgg_view_entity($owner, ['item_view' => 'object/elements/chip']),
38 ]);
elgg_view_module(string $type, string $title, string $body, array $vars=[])
Wrapper function for the module display pattern.
Definition: views.php:919
if(!elgg_extract('show_owner_block', $vars, true)) $owner
Elgg owner block Displays page ownership information.
Definition: owner_block.php:14
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:254
elgg_view_menu($menu, array $vars=[])
Render a menu.
Definition: views.php:441
elgg_view(string $view, array $vars=[], string $viewtype= '')
Return a parsed view.
Definition: views.php:156
if(!$owner instanceof\ElggGroup &&!$owner instanceof\ElggUser) $body
Definition: owner_block.php:19
elgg_view_entity(\ElggEntity $entity, array $vars=[])
Returns a string of a rendered entity.
Definition: views.php:493
elgg_get_page_owner_entity()
Gets the owner entity for the current page.
Definition: pageowner.php:23
$vars
Definition: theme.php:5
elgg_view_exists(string $view, string $viewtype= '', bool $recurse=true)
Returns whether the specified view exists.
Definition: views.php:131