Elgg  Version 6.1
image_block.php
Go to the documentation of this file.
1 <?php
23 $body = elgg_extract('body', $vars, '');
24 unset($vars['body']);
25 
26 $image = elgg_extract('image', $vars, '');
27 unset($vars['image']);
28 
29 $alt_image = elgg_extract('image_alt', $vars, '');
30 unset($vars['image_alt']);
31 
32 $vars['class'] = elgg_extract_class($vars, ['elgg-image-block']);
33 
34 $content = '';
35 if ($image) {
36  $content .= elgg_format_element('div', ['class' => 'elgg-image'], $image);
37 }
38 
39 $content .= elgg_format_element('div', ['class' => 'elgg-body'], $body);
40 
41 if ($alt_image) {
42  $content .= elgg_format_element('div', ['class' => 'elgg-image-alt'], $alt_image);
43 }
44 
45 $tag_name = elgg_extract('tag_name', $vars, 'div');
46 unset($vars['tag_name']);
47 
$vars['class']
Definition: image_block.php:32
$alt_image
Definition: image_block.php:29
if($alt_image) $tag_name
Definition: image_block.php:45
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:256
$image
Definition: image_block.php:26
$body
Elgg image block pattern.
Definition: image_block.php:23
$content
Definition: image_block.php:34
elgg_format_element(string $tag_name, array $attributes=[], string $text= '', array $options=[])
Format an HTML element.
Definition: output.php:145
elgg_extract_class(array $array, array|string $existing=[], string $extract_key= 'class')
Extract class names from an array, optionally merging into a preexisting set.
Definition: elgglib.php:279