function sms_carriers_admin_form in SMS Framework 7
Same name and namespace in other branches
- 6.2 sms.admin.inc \sms_carriers_admin_form()
Form builder for the list of sms carriers.
See also
sms_carriers_admin_form_submit()
1 string reference to 'sms_carriers_admin_form'
- sms_menu in ./
sms.module - Implements hook_menu().
File
- ./
sms.admin.inc, line 151 - The admin sms functions.
Code
function sms_carriers_admin_form($form, &$form_state) {
$carriers = sms_carriers();
$form = array();
foreach ($carriers as $id => $carrier) {
$actions = array();
$css_safe_id = str_replace('.', '-', $id);
switch ($carrier['type']) {
case SMS_CARRIER_DEFAULT:
$storage = t('Default');
break;
case SMS_CARRIER_OVERRIDDEN:
$storage = t('Overridden');
break;
case SMS_CARRIER_NORMAL:
$storage = t('Normal');
break;
}
$form['status']['#tree'] = TRUE;
if (!isset($carrier['status'])) {
$carrier['status'] = 0;
}
$form['status'][$css_safe_id] = array(
'#type' => 'checkbox',
'#title' => check_plain($carrier['name']),
'#description' => check_plain($storage),
'#default_value' => $carrier['status'] == 1,
);
$form['domain'][$css_safe_id] = array(
'#type' => 'markup',
'#markup' => check_plain($id),
);
$actions[] = l(t('Edit'), "admin/smsframework/carriers/{$id}");
if ($carrier['type'] == SMS_CARRIER_OVERRIDDEN) {
$actions[] = l(t('Revert'), "admin/smsframework/carriers/delete/{$id}");
}
elseif ($carrier['type'] == SMS_CARRIER_NORMAL) {
$actions[] = l(t('Delete'), "admin/smsframework/carriers/delete/{$id}");
}
$form['actions'][$css_safe_id] = array(
'#type' => 'markup',
'#markup' => implode(' | ', $actions),
);
}
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save settings'),
);
return $form;
}