Elgg  Version 3.0
remove.php
Go to the documentation of this file.
1 <?php
13 if (elgg_extract('show_remove', $vars, true) === false) {
14  return;
15 }
16 
17 $entity = elgg_extract('entity', $vars);
18 if (!$entity instanceof ElggEntity) {
19  // no way to check for icon
20  return;
21 }
22 
23 $icon_type = elgg_extract('icon_type', $vars, 'icon');
24 $size = elgg_extract('thumb_size', $vars, 'medium');
25 
26 if (!$entity->hasIcon($size, $icon_type)) {
27  // no icon uploaded
28  return;
29 }
30 
31 $name = elgg_extract('remove_name', $vars);
33  // make name based on file name
34  $name = elgg_extract('name', $vars, 'icon') . '_remove';
35 }
36 
38  '#type' => 'checkbox',
39  '#label' => elgg_echo('entity:edit:icon:remove:label'),
40  '#class' => 'elgg-entity-edit-icon-remove',
41  'name' => $name,
42  'value' => 1,
43  'switch' => true,
44 ]);
if(elgg_extract('show_remove', $vars, true)===false) $entity
Show a remove icon toggle.
Definition: remove.php:17
elgg_view_field(array $params=[])
Renders a form field, usually with a wrapper element, a label, help text, etc.
Definition: views.php:1395
if(!$entity instanceof ElggEntity) $icon_type
Definition: remove.php:23
$size
Definition: remove.php:24
elgg_echo($message_key, array $args=[], $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
elgg_is_empty($value)
Check if a value isn&#39;t empty, but allow 0 and &#39;0&#39;.
Definition: input.php:206
elgg echo
Translates a string.
Definition: languages.js:43
if(!$entity->hasIcon($size, $icon_type)) $name
Definition: remove.php:31
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
$vars['type']
Definition: save.php:11