You are here

function sms_valid_get_rulesets_for_form in SMS Framework 6

Same name and namespace in other branches
  1. 6.2 modules/sms_valid/sms_valid.module \sms_valid_get_rulesets_for_form()
  2. 7 modules/sms_valid/sms_valid.module \sms_valid_get_rulesets_for_form()

Get country codes for form options

Parameters

$include_null_option: Whether to include a null option in the resulting array. TRUE or FALSE.

Return value

Options array that can be used in a form select element.

3 calls to sms_valid_get_rulesets_for_form()
sms_send_form in ./sms.module
Send form. Generates a SMS sending form and adds gateway defined elements. The form array that is returned can be merged with an existing form using array_merge().
sms_valid_admin_ruleset_form in modules/sms_valid/sms_valid.admin.inc
Validation ruleset editing form
sms_valid_admin_settings_form in modules/sms_valid/sms_valid.admin.inc
Validation settings form
2 string references to 'sms_valid_get_rulesets_for_form'
sms_admin_settings_form in ./sms.admin.inc
sms_send_form in ./sms.module
Send form. Generates a SMS sending form and adds gateway defined elements. The form array that is returned can be merged with an existing form using array_merge().

File

modules/sms_valid/sms_valid.module, line 407
Number validation feature module for Drupal SMS Framework.

Code

function sms_valid_get_rulesets_for_form($include_null_option = FALSE) {

  // We only really need a null option on the send form
  if ($include_null_option) {
    $options[-1] = '(auto select)';
  }

  // Other options
  $rulesets = sms_valid_get_all_rulesets();
  foreach ($rulesets as $prefix => $ruleset) {
    $suffix = !empty($ruleset['iso2']) ? ' (' . $ruleset['iso2'] . ')' : '';
    $options[$prefix] = $prefix . ' : ' . $ruleset['name'] . $suffix;
  }
  return $options;
}