You are here

function _mandrill_template_map_mailsystem_sort in Mandrill 7.2

Same name and namespace in other branches
  1. 8 modules/mandrill_template/mandrill_template.module \_mandrill_template_map_mailsystem_sort()
  2. 7 modules/mandrill_template/mandrill_template.module \_mandrill_template_map_mailsystem_sort()

Simple sorting algorithm to organize mailsystems arrays in a logical way.

Parameters

string $a: a mailsystem key name

string $b: a mailsystem key name

Return value

int Negative if $a should come before $b, else positive.

1 string reference to '_mandrill_template_map_mailsystem_sort'
mandrill_template_map_usage in modules/mandrill_template/mandrill_template.module
Get all mailsystem keys pointed at mandrill and their template mappings.

File

modules/mandrill_template/mandrill_template.module, line 208
Enables Drupal to send email using Mandrill's template system.

Code

function _mandrill_template_map_mailsystem_sort($a, $b) {
  $first = "default-system";
  $last = "mandrill_test";
  if ($a == $first || $b == $last) {
    return -1;
  }
  if ($b == $first || $a == $last) {
    return 1;
  }

  // Otherwise sort alphabetically, case-agnostic
  return strcasecmp($a, $b);
}