You are here

function flexiaccess_admin_bulkop in Flexi Access 7

Form builder to display available bulk operations.

1 string reference to 'flexiaccess_admin_bulkop'
flexiaccess_menu in ./flexiaccess.module
Implements hook_menu().

File

./flexiaccess.admin.inc, line 178
Administrative page callbacks for the Flexi access module.

Code

function flexiaccess_admin_bulkop($form, &$form_state) {
  $options = array(
    0 => t('Reset all ACL priorities'),
    1 => t('Delete all ACLs'),
  );
  $descriptions = array(
    0 => t('Sets the priority of every ACL entry created by Flexi access to the value specified on the configuration page.'),
    1 => t('Remove all ACLs created by Flexi access.'),
  );
  if (isset($form_state['values']['action_list'])) {

    // Build confirmation form.
    $form['action_chosen'] = array(
      '#type' => 'value',
      '#value' => $form_state['values']['action_list'],
    );
    $form = confirm_form($form, t('Are you sure?'), current_path(), t('You are about to perform the following bulk operation: %operation. This cannot be reversed, and could affect many nodes and users.  Use with caution.', array(
      '%operation' => $options[$form_state['values']['action_list']],
    )));
  }
  else {

    // Build form for first time.
    $form['action_list'] = array(
      '#type' => 'radios',
      '#required' => TRUE,
      '#options' => $options,
    );

    // Add description to each radio option.
    foreach ($form['action_list']['#options'] as $key => $label) {
      $form['action_list'][$key]['#description'] = $descriptions[$key];
    }
    $form['actions'] = array(
      '#type' => 'actions',
    );
    $form['actions']['submit'] = array(
      '#type' => 'submit',
      '#value' => t('Do it!'),
    );
  }
  return $form;
}