Projet

Général

Profil

Paste
Télécharger (1012 octets) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / views / modules / profile / views_handler_field_profile_list.inc @ 7547bb19

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

    
30
  function render_item($count, $item) {
31
    return $item['item'];
32
  }
33

    
34
  function document_self_tokens(&$tokens) {
35
    $tokens['[' . $this->options['id'] . '-item' . ']'] = t('The text of the profile item.');
36
  }
37

    
38
  function add_self_tokens(&$tokens, $item) {
39
    $tokens['[' . $this->options['id'] . '-item' . ']'] = $item['item'];
40
  }
41
}