Elgg  Version 3.0
longtext.php
Go to the documentation of this file.
1 <?php
23 $vars['class'] = elgg_extract_class($vars, 'elgg-input-longtext');
24 
26  'value' => '',
27  'rows' => '10',
28  'cols' => '50',
29  'id' => "elgg-input-" . base_convert(mt_rand(), 10, 36),
30 ];
31 
32 $vars = array_merge($defaults, $vars);
33 
34 $editor_opts = (array) elgg_extract('editor_options', $vars, []);
35 $editor_opts['disabled'] = !elgg_extract('editor', $vars, true);
36 $editor_opts['state'] = elgg_extract('visual', $vars, true) ? 'visual' : 'html';
37 $editor_opts['required'] = elgg_extract('required', $vars);
38 
39 unset($vars['editor']);
40 unset($vars['editor_options']);
41 unset($vars['editor_type']);
42 unset($vars['visual']);
43 
44 $vars['data-editor-opts'] = json_encode($editor_opts);
45 
46 $value = htmlspecialchars($vars['value'], ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
47 unset($vars['value']);
48 
49 echo elgg_view_menu('longtext', [
50  'class' => 'elgg-menu-hz',
51  'textarea_id' => elgg_extract('id', $vars),
52 ]);
53 
54 echo elgg_format_element('textarea', $vars, $value);
$editor_opts
Definition: longtext.php:34
$vars['class']
Definition: longtext.php:23
$value
Definition: longtext.php:46
elgg_extract_class(array $array, $existing=[], $extract_key= 'class')
Extract class names from an array, optionally merging into a preexisting set.
Definition: elgglib.php:1153
elgg_view_menu($menu, array $vars=[])
Render a menu.
Definition: views.php:755
elgg_format_element($tag_name, array $attributes=[], $text= '', array $options=[])
Format an HTML element.
Definition: output.php:168
elgg echo
Translates a string.
Definition: languages.js:43
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
$defaults
Definition: longtext.php:25