views_handler_field_profile_list.inc

  1. 3.x modules/profile/views_handler_field_profile_list.inc
  2. 2.x modules/profile/views_handler_field_profile_list.inc

Definition of views_handler_field_profile_list.

File

modules/profile/views_handler_field_profile_list.inc
View source
  1. <?php
  2. /**
  3. * @file
  4. * Definition of views_handler_field_profile_list.
  5. */
  6. /**
  7. * Field handler display a profile list item.
  8. *
  9. * @ingroup views_field_handlers
  10. */
  11. class views_handler_field_profile_list extends views_handler_field_prerender_list {
  12. /**
  13. * Break up our field into a proper list.
  14. */
  15. function pre_render(&$values) {
  16. $this->items = array();
  17. foreach ($values as $value) {
  18. $field = $this->get_value($value);
  19. $this->items[$field] = array();
  20. foreach (preg_split("/[,\n\r]/", $field) as $item) {
  21. if ($item != '' && $item !== NULL) {
  22. $this->items[$field][] = array('item' => $item);
  23. }
  24. }
  25. }
  26. }
  27. function render_item($count, $item) {
  28. return $item['item'];
  29. }
  30. function document_self_tokens(&$tokens) {
  31. $tokens['[' . $this->options['id'] . '-item' . ']'] = t('The text of the profile item.');
  32. }
  33. function add_self_tokens(&$tokens, $item) {
  34. $tokens['[' . $this->options['id'] . '-item' . ']'] = $item['item'];
  35. }
  36. }