Skip to content

Instantly share code, notes, and snippets.

@tenken
Created March 23, 2012 22:22
Show Gist options
  • Save tenken/2175665 to your computer and use it in GitHub Desktop.
Save tenken/2175665 to your computer and use it in GitHub Desktop.
theme_item_list
<?php
/**
* Implementation of hook_views_pre_render().
*/
function faculty_db_simple_views_pre_render(&$view) {
if ($view->name === 'faculty_rolodex' ) {
$index = array_merge(array('0-9'), array('all'), range('a','z'));
foreach ($index as $letter) {
$class = arg(1) == strtolower($letter) ? 'active' : '';
$link = l(t($letter), arg(0).'/'.strtolower($letter));
$items []= $link;
}
$output = array(
'az-index' => array(
'#items' => $items,
'#theme' => 'item_list',
'#type' => 'ul',
'#attributes' => array('class' => 'az_filter'),
# '#title' => 'a-z index',
),
);
drupal_add_css(
drupal_get_path('module', 'faculty_db_simple') . '/includes/css/faculty_db_simple_base.css',
array('group' => CSS_DEFAULT, 'type' => 'file')
);
$view->attachment_before = drupal_render($output);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment