Elgg  Version master
longtext.php
Go to the documentation of this file.
1 <?php
16 $vars['class'] = elgg_extract_class($vars, 'elgg-input-longtext');
17 
19  'rows' => '10',
20  'cols' => '50',
21  'id' => 'elgg-input-' . base_convert(mt_rand(), 10, 36),
22 ];
23 
24 $vars = array_merge($defaults, $vars);
25 
26 $editor_opts = (array) elgg_extract('editor_options', $vars, []);
27 $editor_opts['disabled'] = !elgg_extract('editor', $vars, true);
28 $editor_opts['required'] = elgg_extract('required', $vars);
29 
30 unset($vars['editor']);
31 unset($vars['editor_options']);
32 unset($vars['editor_type']);
33 
34 $vars['data-editor-opts'] = json_encode($editor_opts);
35 
36 $value = htmlspecialchars(elgg_extract('value', $vars, ''), ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
37 unset($vars['value']);
38 
39 echo elgg_format_element('textarea', $vars, $value);
$editor_opts
Definition: longtext.php:26
$vars['class']
Elgg long text input Displays a long text input field that can use WYSIWYG editor.
Definition: longtext.php:16
$value
Definition: longtext.php:36
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
$defaults
Definition: longtext.php:18
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:277