You are here

function theme_sms_carriers_admin_form in SMS Framework 7

Same name and namespace in other branches
  1. 6.2 sms.admin.inc \theme_sms_carriers_admin_form()

Returns HTML for the sms carriers admin form.

Parameters

$form: A form array.

File

./sms.admin.inc, line 351
The admin sms functions.

Code

function theme_sms_carriers_admin_form($variables) {
  $form = $variables['form'];
  $header = array(
    t('Enabled'),
    t('Carrier'),
    t('Domain'),
    t('Actions'),
  );
  $rows = array();
  if (!empty($form['status'])) {
    foreach (element_children($form['status']) as $element) {
      $name = "<div class='carrier'>";
      $name .= "<strong>{$form['status'][$element]['#title']}</strong>";
      $name .= "<div class='description'>{$form['status'][$element]['#description']}</div>";
      $name .= "</div>";
      unset($form['status'][$element]['#title']);
      unset($form['status'][$element]['#description']);
      $row = [
        'status' => drupal_render($form['status'][$element]),
        'name' => $name,
        'domain' => drupal_render($form['domain'][$element]),
        'actions' => drupal_render($form['actions'][$element]),
      ];
      $rows[] = $row;
    }
  }
  $output = '';
  $output .= theme('table', array(
    'header' => $header,
    'rows' => $rows,
    'empty' => t('No carriers available.'),
    'attributes' => array(
      'class' => array(
        'sms',
      ),
      'id' => 'sms-form-table',
    ),
  ));
  $output .= drupal_render($form['submit']);
  $output .= drupal_render_children($form);
  return $output;
}