function template_preprocess_mostpopular_item in Drupal Most Popular 7
Themes an individual entry in the most popular results. The $item includes a title, url and a count of the number of times it appears within the interval.
By default, this theme function returns HTML of the form:
<a href='$item->url'> <span class='title'>$item->title</span> <span class='count'>($item->count times)</span> </a>
If variable mostpopular_show_count is set to false, the <span class='count'>...</span> part will not appear.
Parameters
array An array containing::
- item: A single most popular item to show. It will have at least the following:
- title: The title of the page
- url: The URL of the page
- count: The number of times the page was viewed.
- sid: The service ID of the currently-selected service.
- iid: The interval ID of the currently-selected interval.
1 string reference to 'template_preprocess_mostpopular_item'
- mostpopular_theme in ./
mostpopular.module - Implements hook_theme().
File
- ./
mostpopular.theme.inc, line 139 - Defines all the pages, blocks and themes for rendering the most popular data to general users.
Code
function template_preprocess_mostpopular_item(&$variables) {
$item = $variables['item'];
if (!empty($item->entity_type) && !empty($item->entity_id)) {
$variables['entity'] = reset(entity_load($item->entity_type, array(
$item->entity_id,
)));
}
if (variable_get('mostpopular_show_count', 1)) {
$variables['show_count'] = true;
}
}