You are here

function workbench_access_check_access_fields in Workbench Access 7

Tests content types for proper field configuration.

Return value

An array of node types that are _not_ configured properly.

1 call to workbench_access_check_access_fields()
workbench_access_requirements in ./workbench_access.install
Implements hook_requirements() to check if workbench_access is configured.

File

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

Code

function workbench_access_check_access_fields() {
  $broken = array();
  $active = workbench_access_get_active_tree();
  if (variable_get('workbench_access_custom_form', 1) || !empty($active['access_scheme']['form_field'])) {
    return $broken;
  }
  $types = node_type_get_types();
  foreach ($types as $type => $data) {
    $fields = workbench_access_get_assigned_fields($type);
    $check = FALSE;
    if (variable_get('workbench_access_node_type_' . $type, 1)) {
      foreach ($fields as $field) {
        if (!empty($field['instance_info']['workbench_access_field'])) {
          $check = TRUE;
        }
      }
    }
    else {
      $check = TRUE;
    }
    if (!$check) {
      $broken[] = $type;
    }
  }
  return $broken;
}