function _mandrill_template_map_mailsystem_sort in Mandrill 8
Same name and namespace in other branches
- 7.2 modules/mandrill_template/mandrill_template.module \_mandrill_template_map_mailsystem_sort()
- 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 128 - 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);
}