Skip navigation
Help

element_sort_by_title

7 common.inc element_sort_by_title($a, $b)

Array sorting callback; sorts elements by title.

2 string references to 'element_sort_by_title'

File

drupal/includes/common.inc, line 6023
Common functions that many Drupal modules will need to reference.

Code

function element_sort_by_title($a, $b) {
  $a_title = (is_array($a) && isset($a['#title'])) ? $a['#title'] : '';
  $b_title = (is_array($b) && isset($b['#title'])) ? $b['#title'] : '';
  return strnatcasecmp($a_title, $b_title);
}