function workbench_workflows_load_all in Workbench Moderation 7.2
Load a single workbench moderation exportable.
Parameters
string $type: Allowed values are 'states', 'events', and 'workflows'
string $name: The machine name of the exportable.
$reset: A boolean for whether the static cache should be reset. Returns a CTools exportable object.
6 calls to workbench_workflows_load_all()
- WorkbenchWorkflowsAdminUITestCase::testUIInstallofDefaultWorkflow in modules/
workbench_workflows/ tests/ workbench_workflows.test - Test View Draft tab.
- workbench_moderation_permission in ./
workbench_moderation.module - Implements hook_permission().
- workbench_workflows_load_enabled in modules/
workbench_workflows/ workbench_workflows.module - Load enabled workbench moderation exportables.
- workbench_workflows_requirements in modules/
workbench_workflows/ workbench_workflows.install - Implements hook_requirements().
- workbench_workflows_ui::edit_form_events in modules/
workbench_workflows/ plugins/ export_ui/ workbench_workflows_ui.class.php
File
- modules/
workbench_workflows/ workbench_workflows.module, line 166 - workbench_workflows.module
Code
function workbench_workflows_load_all($type = 'states', $reset = FALSE) {
$cache =& drupal_static(__FUNCTION__, array());
// We check our own private static because individual minis could have
// been loaded prior to load all and we need to know that.
if (empty($cache[$type]) || $reset) {
// If reseting, also reset ctools_export_load_object_all.
// It seems like overkill but it is the cache used by ctools_export_load_object()
// @todo, this needs a test.
if ($reset) {
drupal_static_reset('ctools_export_load_object_all');
}
$all_loaded = TRUE;
if ($reset) {
$cache = array();
}
ctools_include('export');
$type_exportables = ctools_export_load_object('workbench_workflows_' . $type);
// The sort function expects a title property.
// @todo, perhaps these objects should have those as a column. For now,
// copy the admin_title.
foreach ($type_exportables as $machine_name => $exportable) {
if (empty($exportable->title) && !empty($exportable->admin_title)) {
$type_exportables[$machine_name]->title = $exportable->admin_title;
}
// If scheduling is enabled we need some transition events and a schedule
// state. These items can be generated dynamically based on the available
// configuration.
if (module_exists('state_flow_schedule')) {
// Create transition events for schedulable event.
if ($type == 'events' && !empty($exportable->schedulable)) {
$transition_event = workbench_workflows_create_scheduled_tansition_event($type_exportables[$machine_name]);
$type_exportables[$transition_event->name] = $transition_event;
}
// Add schedule state.
if ($type == 'states') {
$state = workbench_workflows_create_schedule_state();
$type_exportables[$state->name] = $state;
}
}
}
uasort($type_exportables, 'ctools_plugin_sort');
$cache[$type] = $type_exportables;
}
return $cache[$type];
}