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