function element_sort_by_title

element_sort_by_title($a, $b)

Array sorting callback; sorts elements by title.

File

includes/common.inc, line 6442
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);
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!common.inc/function/element_sort_by_title/7.x