longtext.php 865 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /**
  3. * Elgg long text input
  4. * Displays a long text input field that can use WYSIWYG editor
  5. *
  6. * @package Elgg
  7. * @subpackage Core
  8. *
  9. * @uses $vars['value'] The current value, if any - will be html encoded
  10. * @uses $vars['disabled'] Is the input field disabled?
  11. * @uses $vars['class'] Additional CSS class
  12. */
  13. $vars['class'] = (array) elgg_extract('class', $vars, []);
  14. $vars['class'][] = 'elgg-input-longtext';
  15. $defaults = array(
  16. 'value' => '',
  17. 'rows' => '10',
  18. 'cols' => '50',
  19. 'id' => 'elgg-input-' . rand(), //@todo make this more robust
  20. );
  21. $vars = array_merge($defaults, $vars);
  22. $value = htmlspecialchars($vars['value'], ENT_QUOTES, 'UTF-8');
  23. unset($vars['value']);
  24. echo elgg_view_menu('longtext', array(
  25. 'sort_by' => 'priority',
  26. 'class' => 'elgg-menu-hz',
  27. 'id' => $vars['id'],
  28. ));
  29. echo elgg_format_element('textarea', $vars, $value);