Elgg  Version master
color.php
Go to the documentation of this file.
1 <?php
8 $value = (string) elgg_extract('value', $vars);
9 if (!preg_match('/^#[a-f0-9]{6}$/i', $value)) {
10  return;
11 }
12 
13 $vars['style'] = "background-color: {$value}";
14 $vars['value'] = strtoupper($vars['value']);
15 $vars['class'] = 'elgg-color-box';
16 
17 echo elgg_format_element('span', $vars) . ' ' . elgg_view('output/text', $vars);
$vars['class']
Elgg color input Displays a color input field.
Definition: color.php:7
$value
Displays the input color.
Definition: color.php:8
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:254
elgg_view(string $view, array $vars=[], string $viewtype= '')
Return a parsed view.
Definition: views.php:156
elgg_format_element(string $tag_name, array $attributes=[], string $text= '', array $options=[])
Format an HTML element.
Definition: output.php:145