You are here

function workbench_access_find_form_elements in Workbench Access 7

Find form elements that control access.

See also

workbench_access_get_assigned_fields()

1 call to workbench_access_find_form_elements()
workbench_access_default_form_element in ./workbench_access.module
Find and alter the native form element for node editing.

File

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

Code

function workbench_access_find_form_elements(&$form) {
  $active = workbench_access_get_active_tree();
  $form['workbench_access_fields'] = array(
    '#type' => 'value',
    '#value' => array(),
    '#access_type' => $active['access_scheme']['access_type'],
  );

  // Find the menu form, which is easy.
  if ($active['access_scheme']['access_type'] == 'menu') {
    $form['workbench_access_fields']['#value'][] = 'menu';
  }
  else {
    $type = $form['#node']->type;
    $fields = workbench_access_get_assigned_fields($type);
    foreach ($fields as $field => $info) {
      if (!empty($info['instance_info']['workbench_access_field'])) {
        $form['workbench_access_fields']['#value'][] = $field;
      }
    }
  }
}