You are here

function _birthdays_field_instances_compare in Birthdays 7

Callback for usort() within _birthdays_field_instances().

Used to sort an array of field instances by entity type, bundle name and field name as humans would do.

See also

strnatcmp()

1 string reference to '_birthdays_field_instances_compare'
_birthdays_field_instances in ./birthdays.module
Gets all instances of birthday fields that are around.

File

./birthdays.module, line 988
The Birthdays module allows users to add their birthday to their profile. It lists birthdays on a seperate page and in different blocks. Users can receive an email on their birthday automatically, and the administrator can receive daily reminders of…

Code

function _birthdays_field_instances_compare($a, $b) {

  // Entity types have first priority.
  if ($result = strnatcmp($a['entity_type'], $b['entity_type'])) {
    return $result;
  }

  // Next are bundle names.
  if ($result = strnatcmp($a['bundle'], $b['bundle'])) {
    return $result;
  }

  // The field name at last.
  return strnatcmp($a['field_name'], $b['field_name']);
}