Elgg  Version 4.3
thumb.php
Go to the documentation of this file.
1 <?php
12 if (elgg_extract('show_thumb', $vars, !elgg_extract('cropper_enabled', $vars, false)) === 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_format_element($tag_name, array $attributes=[], $text= '', array $options=[])
Format an HTML element.
Definition: output.php:135
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:547
if(elgg_extract('show_thumb', $vars,!elgg_extract('cropper_enabled', $vars, false))===false) $entity
Show an example of the current icon.
Definition: thumb.php:16
$size
Definition: thumb.php:23
if(!$entity instanceof ElggEntity) $icon_type
Definition: thumb.php:22
elgg echo
Translates a string.
Definition: deprecated.js:530
$vars['head']
Definition: html.php:24
elgg_view($view, $vars=[], $viewtype= '')
Return a parsed view.
Definition: views.php:179