You are here

function recipe_get_node_alpha_list in Recipe 6

1 call to recipe_get_node_alpha_list()
recipe_name_index_page in ./recipe_name_index.inc
@file recipe_name_index.inc - This is an include file containing most all of the recipe name index page functionality.

File

./recipe_name_index.inc, line 92
recipe_name_index.inc - This is an include file containing most all of the recipe name index page functionality.

Code

function recipe_get_node_alpha_list(&$node_list = NULL) {
  $alpha_list = array();
  foreach ($node_list as $n) {
    $letter = '';
    if (preg_match('/([A-Za-z0-9])/', $n->title, $matches)) {
      $letter = strtolower($matches[1]);
    }
    else {
      $letter = strtolower(drupal_substr($n->title, 0, 1));
    }
    if (is_numeric($letter)) {
      $letter = '0-9';
    }
    $n->letter = $letter;
    $alpha_list[$letter] = 1;
  }
  usort($node_list, 'node_list_cmp');
  return $alpha_list;
}