You are here

function theme_favorites in Favorites 7

Same name and namespace in other branches
  1. 6 favorites.module \theme_favorites()
  2. 7.2 favorites.module \theme_favorites()

Theme callback.

Return a themed item list of favorites with title, link and link to delete.

1 theme call to theme_favorites()
favorites_list in ./favorites.module
Generate the "My Favorites" list.

File

./favorites.module, line 152
The favorites module allows users to bookmark any path within a site.

Code

function theme_favorites($favorites = array()) {
  $items = array();
  $destination = drupal_get_destination();
  $destination = explode('=', $destination['destination'], 2);
  foreach ($favorites['favorites'] as $favorite) {
    $items[] = l($favorite->title, $favorite->path, array(
      'query' => unserialize($favorite->query),
    )) . ' ' . l('x', 'favorites/remove/' . $favorite->fid, array(
      'query' => array(
        'token' => $favorite->token,
        'destination' => $destination[0],
      ),
      'attributes' => array(
        'class' => array(
          'favorites-remove',
        ),
        'title' => t('delete this item'),
      ),
    ));
  }
  return theme('item_list', array(
    'items' => $items,
    'type' => 'ul',
  ));
}