You are here

function wsconfig_form_wsconfig_type_overview_form_alter in Web Service Data 7

Implements hook_form_alter(). Sorts the WS Config type overview table.

File

modules/wsconfig/wsconfig.module, line 240
Main module for wsconfig

Code

function wsconfig_form_wsconfig_type_overview_form_alter(&$form, &$form_state) {
  usort($form['table']['#rows'], '_wsconfig_form_overview_sort');
  $name = array_shift($form['table']['#header']);
  array_unshift($form['table']['#header'], $name, t('Active'));
  $types = wsconfig_get_types();
  foreach ($form['table']['#rows'] as $key => $row) {
    $type = $types[$row[0]['data']['#name']];
    if ($type
      ->isDisabled()) {
      $degraded = $type
        ->getDegraded();
      if ($degraded) {
        $active = t('Degraded - Calls to WSConfigs using this type will not be run.  Service will be automatically reenabled in %seconds.', array(
          '%seconds' => $degraded,
        ));
      }
      else {
        $active = t('Disabled - Calls to WSConfigs using this type will not be run.');
      }
    }
    else {
      $active = t('Enabled');
    }
    $name = array_shift($form['table']['#rows'][$key]);
    array_unshift($form['table']['#rows'][$key], $name, $active);
  }
}