Elgg  Version 4.3
remove.php
Go to the documentation of this file.
1 <?php
12 if (elgg_extract('show_remove', $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 if (!$entity->hasIcon('master', $icon_type)) {
24  // no icon uploaded
25  return;
26 }
27 
28 $name = elgg_extract('remove_name', $vars);
30  // make name based on file name
31  $name = elgg_extract('name', $vars, 'icon') . '_remove';
32 }
33 
35  '#type' => 'checkbox',
36  '#label' => elgg_echo('entity:edit:icon:remove:label'),
37  '#class' => 'elgg-entity-edit-icon-remove',
38  'name' => $name,
39  'value' => 1,
40  'switch' => true,
41 ]);
if(elgg_extract('show_remove', $vars, true)===false) $entity
Show a remove icon toggle.
Definition: remove.php:16
elgg_view_field(array $params=[])
Renders a form field, usually with a wrapper element, a label, help text, etc.
Definition: views.php:1143
if(!$entity instanceof ElggEntity) $icon_type
Definition: remove.php:22
if(!$entity->hasIcon('master', $icon_type)) $name
Definition: remove.php:28
elgg_echo($message_key, array $args=[], $language="")
Elgg language module Functions to manage language and translations.
Definition: languages.php:18
elgg_is_empty($value)
Check if a value isn&#39;t empty, but allow 0 and &#39;0&#39;.
Definition: input.php:179
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
elgg echo
Translates a string.
Definition: deprecated.js:530
$vars['head']
Definition: html.php:24