Projet

Général

Profil

Paste
Télécharger (1,28 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / views / handlers / views_handler_area_text_custom.inc @ 7547bb19

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
  function option_definition() {
16
    $options = parent::option_definition();
17
    unset($options['format']);
18
    return $options;
19
  }
20

    
21
  function options_form(&$form, &$form_state) {
22
    parent::options_form($form, $form_state);
23

    
24
    // Alter the form element, to be a regular text area.
25
    $form['content']['#type'] = 'textarea';
26
    unset($form['content']['#format']);
27
    unset($form['content']['#wysiwyg']);
28

    
29
    // @TODO: Use the token refactored base class.
30
  }
31

    
32
  // Empty, so we don't inherit options_submit from the parent.
33
  function options_submit(&$form, &$form_state) {
34
  }
35

    
36
  function render($empty = FALSE) {
37
    if (!$empty || !empty($this->options['empty'])) {
38
      return $this->render_textarea_custom($this->options['content']);
39
    }
40

    
41
    return '';
42
  }
43

    
44
  /**
45
   * Render a text area with filter_xss_admin.
46
   */
47
  function render_textarea_custom($value) {
48
    if ($value) {
49
      if ($this->options['tokenize']) {
50
        $value = $this->view->style_plugin->tokenize_value($value, 0);
51
      }
52
      return $this->sanitize_value($value, 'xss_admin');
53
    }
54
  }
55

    
56
}