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