Elgg  Version 3.0
crop.php
Go to the documentation of this file.
1 <?php
8 $entity = elgg_extract('entity', $vars);
9 if (!$entity instanceof \ElggUser) {
10  return;
11 }
12 
13 elgg_load_js('jquery.imgareaselect');
14 elgg_load_js('elgg.avatar_cropper');
15 elgg_load_css('jquery.imgareaselect');
16 
17 echo elgg_view('output/img', [
18  'src' => $entity->getIconUrl('master'),
19  'alt' => elgg_echo('avatar'),
20  'class' => 'mrl',
21  'id' => 'user-avatar-cropper',
22  'width' => '550',
23 ]);
24 
25 $coords = ['x1', 'x2', 'y1', 'y2'];
26 foreach ($coords as $coord) {
28  '#type' => 'hidden',
29  'name' => $coord,
30  'value' => $entity->$coord,
31  ]);
32 }
33 
35  '#type' => 'hidden',
36  'name' => 'guid',
37  'value' => $entity->guid,
38 ]);
39 
40 
42  '#type' => 'submit',
43  'value' => elgg_echo('avatar:create'),
44 ]);
45 
elgg_view_field(array $params=[])
Renders a form field, usually with a wrapper element, a label, help text, etc.
Definition: views.php:1395
$footer
Definition: crop.php:41
elgg_echo($message_key, array $args=[], $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
elgg_set_form_footer($footer= '')
Sets form footer and defers its rendering until the form view and extensions have been rendered...
Definition: views.php:1331
elgg_load_css($name)
Load a CSS file for this page.
Definition: elgglib.php:234
$entity
Avatar crop form.
Definition: crop.php:8
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_load_js($name)
Load a JavaScript resource on this page.
Definition: elgglib.php:156
$vars['type']
Definition: save.php:11
elgg_view($view, $vars=[], $viewtype= '')
Return a parsed view.
Definition: views.php:246
if(!$owner||!$owner->canEdit()) if(!$owner->hasIcon('master')) $coords
Definition: crop.php:18