Elgg  Version 3.0
edit.php
Go to the documentation of this file.
1 <?php
6 $username = elgg_extract('username', $vars);
8 
9 if (!$entity instanceof ElggUser || !$entity->canEdit()) {
10  throw new \Elgg\EntityPermissionsException(elgg_echo('avatar:noaccess'));
11 }
12 
13 elgg_push_context('settings');
14 elgg_push_context('profile_edit');
15 
16 $title = elgg_echo('avatar:edit');
17 
19 
20 $content = elgg_view('core/avatar/upload', ['entity' => $entity]);
21 
22 // only offer the crop view if an avatar has been uploaded
23 if ($entity->hasIcon('master')) {
24  $content .= elgg_view('core/avatar/crop', ['entity' => $entity]);
25 }
26 
27 $body = elgg_view_layout('one_sidebar', [
28  'title' => $title,
29  'content' => $content,
30  'show_owner_block_menu' => false,
31 ]);
32 
if($entity->hasIcon('master')) $body
Definition: edit.php:27
elgg_echo($message_key, array $args=[], $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
elgg_set_page_owner_guid($guid)
Set the guid of the entity that owns this page.
Definition: pageowner.php:81
elgg_view_page($title, $body, $page_shell= 'default', $vars=[])
Assembles and outputs a full page.
Definition: views.php:360
get_user_by_username($username)
Get user by username.
Definition: users.php:61
$entity
Definition: edit.php:7
$title
Definition: edit.php:16
$username
Upload and crop an avatar page.
Definition: edit.php:6
elgg echo
Translates a string.
Definition: languages.js:43
elgg_extract($key, $array, $default=null, $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:1131
elgg_push_context($context)
Push a context onto the top of the stack.
Definition: pageowner.php:212
elgg_view_layout($layout_name, $vars=[])
Displays a layout with optional parameters.
Definition: views.php:593
$content
Definition: edit.php:20
$vars['type']
Definition: save.php:11
elgg_view($view, $vars=[], $viewtype= '')
Return a parsed view.
Definition: views.php:246