content.php 690 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. /**
  3. * Friend widget display view
  4. *
  5. */
  6. // owner of the widget
  7. $owner = $vars['entity']->getOwnerEntity();
  8. $num_display = sanitize_int($vars['entity']->num_display, false);
  9. // set default value for display number
  10. if (!$num_display) {
  11. $num_display = 12;
  12. }
  13. // get the correct size
  14. $size = $vars['entity']->icon_size;
  15. if (elgg_instanceof($owner, 'user')) {
  16. $html = elgg_list_entities_from_relationship(array(
  17. 'type' => 'user',
  18. 'relationship' => 'friend',
  19. 'relationship_guid' => $owner->guid,
  20. 'limit' => $num_display,
  21. 'size' => $size,
  22. 'list_type' => 'gallery',
  23. 'pagination' => false,
  24. 'no_results' => elgg_echo('friends:none'),
  25. ));
  26. if ($html) {
  27. echo $html;
  28. }
  29. }