You are here

function workbench_access_edit_form_alter in Workbench Access 7

Generic form for adding a section checkbox to another form.

Parameters

&$form: The form being altered.

$access_id: The access_id defined by the form.

$type: The type of entity being saved (term, vocabulary, menu_link, etc.)

4 calls to workbench_access_edit_form_alter()
workbench_access_form_menu_edit_item_alter in ./workbench_access.module
Implements hook_form_alter().
workbench_access_form_menu_edit_menu_alter in ./workbench_access.module
Implements hook_form_alter().
workbench_access_form_taxonomy_form_term_alter in ./workbench_access.module
Implements hook_form_FORM_ID_alter().
workbench_access_form_taxonomy_form_vocabulary_alter in ./workbench_access.module
Implements hook_form_FORM_ID_alter().

File

./workbench_access.module, line 1746
Workbench Access module file.

Code

function workbench_access_edit_form_alter(&$form, $access_id, $type) {
  $active = workbench_access_get_active_tree();
  $form['workbench_access'] = array(
    '#type' => 'checkbox',
    '#title' => t('Workbench Access editorial section'),
    '#default_value' => variable_get('workbench_access_auto_assign', 1) == 1 ? 1 : isset($active['active'][$access_id]),
    '#disabled' => variable_get('workbench_access_auto_assign', 1),
    '#description' => t('Enable this !type as an active editorial section.', array(
      '!type' => str_replace('_', ' ', $type),
    )),
    '#weight' => 1,
  );
  $form['workbench_access_exists'] = array(
    '#type' => 'value',
    '#value' => isset($active['active'][$access_id]),
  );

  // If auto-assign is OFF, then add a submit handler.
  // See workbench_access_taxonomy_term_insert().
  if (!variable_get('workbench_access_auto_assign', 1)) {
    $form['#submit'][] = 'workbench_access_' . $type . '_submit';
  }
}