Elgg  Version 5.1
thumb.php
Go to the documentation of this file.
1 <?php
12 if (elgg_extract('show_thumb', $vars, !elgg_extract('cropper_enabled', $vars, true)) === false) {
13  return;
14 }
15 
16 $entity = elgg_extract('entity', $vars);
17 if (!$entity instanceof ElggEntity) {
18  // no way to check for icon
19  return;
20 }
21 
22 $icon_type = elgg_extract('icon_type', $vars, 'icon');
23 $size = elgg_extract('thumb_size', $vars, 'medium');
24 
25 if (!$entity->hasIcon($size, $icon_type)) {
26  // no icon uploaded
27  return;
28 }
29 
30 echo elgg_format_element('div', ['class' => ['elgg-entity-icon-edit-thumb']], elgg_view('output/img', [
31  'src' => $entity->getIconURL([
32  'size' => $size,
33  'type' => $icon_type,
34  ]),
35  'alt' => "{$icon_type}-{$size}",
36  'title' => $entity->getDisplayName(),
37 ]));
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(string $view, array $vars=[], string $viewtype= '')
Return a parsed view.
Definition: views.php:177
$size
Definition: thumb.php:23
if(!$entity instanceof ElggEntity) $icon_type
Definition: thumb.php:22
$vars
Definition: theme.php:5
elgg_format_element(string $tag_name, array $attributes=[], string $text= '', array $options=[])
Format an HTML element.
Definition: output.php:145
if(elgg_extract('show_thumb', $vars,!elgg_extract('cropper_enabled', $vars, true))===false) $entity
Show an example of the current icon.
Definition: thumb.php:16