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

File

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