You are here

function hook_workbench_access_load in Workbench Access 7

Loads information about an access_id.

Simple lookup function to translate data from one storage system to the Workbench Access API. This function will be passed a $scheme array from hook_workbench_access_info() plus an 'access_id' element that defines the access_id being checked.

Note that our vocabulary example below checks machine name and term id since we use VARCHAR storage keys.

Parameters

$scheme: The active access scheme.

Return value

The name, description and access_id for the given scheme.

2 functions implement hook_workbench_access_load()

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_load in modules/menu.workbench_access.inc
Implements hook_workbench_access_load().
taxonomy_workbench_access_load in modules/taxonomy.workbench_access.inc
Implements hook_workbench_access_load().

File

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

Code

function hook_workbench_access_load($scheme) {
  if ($vocabulary = taxonomy_vocabulary_machine_name_load($scheme['access_id'])) {
    $data = array(
      'name' => $vocabulary->name,
      'description' => $vocabulary->description,
      'access_id' => $vocabulary->machine_name,
    );
  }
  else {
    $term = taxonomy_term_load($scheme['access_id']);
    $data = array(
      'name' => $term->name,
      'description' => $term->description,
      'access_id' => $term->tid,
    );
  }
  return $data;
}