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