Projet

Général

Profil

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

root / drupal7 / sites / all / modules / views / modules / profile / views_handler_field_profile_list.inc @ 5d12d676

1
<?php
2

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

    
8
/**
9
 * Field handler display a profile list item.
10
 *
11
 * @ingroup views_field_handlers
12
 */
13
class views_handler_field_profile_list extends views_handler_field_prerender_list {
14

    
15
  /**
16
   * Break up our field into a proper list.
17
   */
18
  public function pre_render(&$values) {
19
    $this->items = array();
20
    foreach ($values as $value) {
21
      $field = $this->get_value($value);
22
      $this->items[$field] = array();
23
      foreach (preg_split("/[,\n\r]/", $field) as $item) {
24
        if ($item != '' && $item !== NULL) {
25
          $this->items[$field][] = array('item' => $item);
26
        }
27
      }
28
    }
29
  }
30

    
31
  /**
32
   * {@inheritdoc}
33
   */
34
  public function render_item($count, $item) {
35
    return $item['item'];
36
  }
37

    
38
  /**
39
   * {@inheritdoc}
40
   */
41
  public function document_self_tokens(&$tokens) {
42
    $tokens['[' . $this->options['id'] . '-item' . ']'] = t('The text of the profile item.');
43
  }
44

    
45
  /**
46
   * {@inheritdoc}
47
   */
48
  public function add_self_tokens(&$tokens, $item) {
49
    $tokens['[' . $this->options['id'] . '-item' . ']'] = $item['item'];
50
  }
51

    
52
}