You are here

function fasttoggle_form_alter in Fasttoggle 5

Same name and namespace in other branches
  1. 6 fasttoggle.module \fasttoggle_form_alter()

Implementation of hook_form_alter().

File

./fasttoggle.module, line 336
Enables fast toggling of binary or not so binary settings

Code

function fasttoggle_form_alter($form_id, &$form) {
  switch ($form_id) {
    case 'node_admin_nodes':

      // Add published/unpublished toggle links to the node overview page.
      if (isset($form['status'])) {
        foreach ($form['status'] as $key => $status) {
          $form['status'][$key]['#value'] = fasttoggle($status['#value'], 'node/' . $key . '/toggle/status', true, 'status_' . $key);
        }
      }
      break;
    case 'user_admin_account':

      // Add blocked/unblocked toggle links to the user overview page.
      if (isset($form['status'])) {
        foreach ($form['status'] as $key => $status) {
          $form['status'][$key]['#value'] = fasttoggle($status['#value'], 'admin/user/' . $key . '/toggle/status', true, 'status_' . $key);
        }
      }
      break;
  }
}