Project

General

Profile

Paste
Download (1.6 KB) Statistics
| Branch: | Revision:

root / drupal7 / sites / all / modules / views / handlers / views_handler_area_text_custom.inc @ 4003efde

1
<?php
2

    
3
/**
4
 * @file
5
 * Definition of views_handler_area_text_custom.
6
 */
7

    
8
/**
9
 * Views area text custom handler.
10
 *
11
 * @ingroup views_area_handlers
12
 */
13
class views_handler_area_text_custom extends views_handler_area_text {
14

    
15
  /**
16
   * {@inheritdoc}
17
   */
18
  public function option_definition() {
19
    $options = parent::option_definition();
20
    unset($options['format']);
21
    return $options;
22
  }
23

    
24
  /**
25
   * {@inheritdoc}
26
   */
27
  public function options_form(&$form, &$form_state) {
28
    parent::options_form($form, $form_state);
29

    
30
    // Alter the form element, to be a regular text area.
31
    $form['content']['#type'] = 'textarea';
32
    unset($form['content']['#format']);
33
    unset($form['content']['#wysiwyg']);
34

    
35
    // @todo Use the token refactored base class.
36
  }
37

    
38
  /**
39
   * {@inheritdoc}
40
   */
41
  public function options_submit(&$form, &$form_state) {
42
    // Empty, so we don't inherit options_submit from the parent.
43
  }
44

    
45
  /**
46
   * {@inheritdoc}
47
   */
48
  public function render($empty = FALSE) {
49
    if (!$empty || !empty($this->options['empty'])) {
50
      return $this->render_textarea_custom($this->options['content']);
51
    }
52

    
53
    return '';
54
  }
55

    
56
  /**
57
   * Render a text area with filter_xss_admin.
58
   *
59
   * @param string $value
60
   *   The text area string to process.
61
   *
62
   * @return string
63
   *   The string after it has been sanitized, optionally tokenized too.
64
   */
65
  public function render_textarea_custom($value) {
66
    if ($value) {
67
      if ($this->options['tokenize']) {
68
        $value = $this->view->style_plugin->tokenize_value($value, 0);
69
      }
70
      return $this->sanitize_value($value, 'xss_admin');
71
    }
72
  }
73

    
74
}