You are here

function taxonomy_workbench_access_field_ui_field_edit_form_alter in Workbench Access 7

Implements hook_workbench_access_FORM_ID_alter().

File

modules/taxonomy.workbench_access.inc, line 99
Taxonomy integration for Workbench Access.

Code

function taxonomy_workbench_access_field_ui_field_edit_form_alter(&$form, &$form_state, $active) {
  _workbench_access_taxonomy_remove_option($form);
  $form['instance']['workbench_access_field'] = array(
    '#type' => 'checkbox',
    '#title' => t('Workbench Access control field'),
    '#description' => t('Use this field to determine access control for content editing.'),
    '#default_value' => !empty($form['#instance']['workbench_access_field']),
    '#weight' => -15,
  );
  $allowed = workbench_access_get_available_fields($form['#instance']['bundle']);
  $instance = $form['#instance']['field_name'];
  if (!isset($allowed[$instance])) {
    $form['instance']['workbench_access_field']['#disabled'] = TRUE;
    $form['instance']['workbench_access_field']['#default_value'] = 0;
    $form['instance']['workbench_access_field']['#description'] = t('This field cannot be used for access control.');
  }
}