You are here

function hook_workbench_access_FORM_ID_alter in Workbench Access 7

Allows modules to edit forms associated with Workbench Access.

This convenience function allows other modules to extend the hook_form_alter() provided by workbench_access_form_alter(). This hook allows other modules to change the behavior of the core module without worrying about execution order of their hook respective to other modules.

Parameters

&$form: The form element defined by workbench_access_form_alter(), passed by reference.

&$form_state: The current form state, passed by reference.

$active: The active data information for the access scheme.

See also

taxonomy_workbench_access_field_form_alter()

6 functions implement hook_workbench_access_FORM_ID_alter()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

menu_workbench_access_default_form_alter in modules/menu.workbench_access.inc
Executes a form alter on a specific FieldAPI form element.
taxonomy_workbench_access_default_form_alter in modules/taxonomy.workbench_access.inc
Executes a form alter on a specific FieldAPI form element.
taxonomy_workbench_access_field_form_alter in modules/taxonomy.workbench_access.inc
Implements hook_workbench_access_FORM_ID_alter().
taxonomy_workbench_access_field_ui_field_edit_form_alter in modules/taxonomy.workbench_access.inc
Implements hook_workbench_access_FORM_ID_alter().
taxonomy_workbench_access_field_ui_field_settings_form_alter in modules/taxonomy.workbench_access.inc
Implements hook_workbench_access_FORM_ID_alter().

... See full list

File

./workbench_access.api.php, line 497
API documentation file for Workbench Access.

Code

function hook_workbench_access_FORM_ID_alter(&$form, &$form_state, $active) {

  /**
   * Workbench Access provides its own taxonomy, which cannot be used
   * in normal taxonomy selection forms. This sample alter hook operates on
   * field forms in order to remove the workbench_access vocabulary from
   * selection options.
   */
  if (!isset($form['field']['settings']['allowed_values'])) {
    return;
  }
  foreach ($form['field']['settings']['allowed_values'] as $key => $value) {
    if (isset($value['vocabulary']) && isset($form['field']['settings']['allowed_values'][$key]['vocabulary']['#options']['workbench_access'])) {
      unset($form['field']['settings']['allowed_values'][$key]['vocabulary']['#options']['workbench_access']);
    }
  }
}