views_handler_area_text_custom.inc

Definition of views_handler_area_text_custom.

File

handlers/views_handler_area_text_custom.inc
View source
  1. <?php
  2. /**
  3. * @file
  4. * Definition of views_handler_area_text_custom.
  5. */
  6. /**
  7. * Views area text custom handler.
  8. *
  9. * @ingroup views_area_handlers
  10. */
  11. class views_handler_area_text_custom extends views_handler_area_text {
  12. function option_definition() {
  13. $options = parent::option_definition();
  14. unset($options['format']);
  15. return $options;
  16. }
  17. function options_form(&$form, &$form_state) {
  18. parent::options_form($form, $form_state);
  19. // Alter the form element, to be a regular text area.
  20. $form['content']['#type'] = 'textarea';
  21. unset($form['content']['#format']);
  22. unset($form['content']['#wysiwyg']);
  23. // @TODO: Use the token refactored base class.
  24. }
  25. // Empty, so we don't inherit options_submit from the parent.
  26. function options_submit(&$form, &$form_state) {
  27. }
  28. function render($empty = FALSE) {
  29. if (!$empty || !empty($this->options['empty'])) {
  30. return $this->render_textarea_custom($this->options['content']);
  31. }
  32. return '';
  33. }
  34. /**
  35. * Render a text area with filter_xss_admin.
  36. */
  37. function render_textarea_custom($value) {
  38. if ($value) {
  39. if ($this->options['tokenize']) {
  40. $value = $this->view->style_plugin->tokenize_value($value, 0);
  41. }
  42. return $this->sanitize_value($value, 'xss_admin');
  43. }
  44. }
  45. }