You are here

function _forward_top5_list in Forward 7.3

Theme the top 5 list of users, nodes or comments used by the dynamic content block

1 call to _forward_top5_list()
forward_form_submit in ./forward.module
Submit callback function for forward form submit

File

./forward.module, line 1608
Allows forwarding of entities by email, and provides a record of how often each has been forwarded.

Code

function _forward_top5_list($query, $base_url, $entity_type) {
  $items = '';
  $query
    ->range(0, 5);
  $result = $query
    ->execute();
  foreach ($result as $item) {
    if ($entity_type == 'user') {
      $items .= '<li>' . l($item->name, 'user/' . $item->uid, array(
        'absolute' => TRUE,
      )) . '</li>';
    }
    elseif ($entity_type == 'comment') {
      $items .= '<li>' . l($item->subject, 'node/' . $item->nid, array(
        'absolute' => TRUE,
        'fragment' => 'comment-' . $item->cid,
      )) . '</li>';
    }
    else {
      $items .= '<li>' . l($item->title, 'node/' . $item->nid, array(
        'absolute' => TRUE,
      )) . '</li>';
    }
  }
  if ($items) {
    $items = '<ul>' . $items . '</ul>';
  }
  return $items;
}