function oa_wizard_get_steps in Open Atrium Wizard 7.2
Retrieve the wizard steps for a wizard.
Expands a string value of the format: Key1:Value1|Key2:Value2|Key3:Value3 for each individual step (separated by newlines)
1 call to oa_wizard_get_steps()
- oa_wizard_modal_callback in ./
oa_wizard.module - Node add modal callback.
File
- ./
oa_wizard.module, line 193 - Code for the OpenAtrium Wizard.
Code
function oa_wizard_get_steps($wizard_name) {
$steps = array();
$wizard = oa_wizard_machine_name_load($wizard_name);
if (isset($wizard->field_wizard_steps[LANGUAGE_NONE][0]['value'])) {
$steps_string = $wizard->field_wizard_steps[LANGUAGE_NONE][0]['value'];
$step_array = explode("\n", $steps_string);
foreach ($step_array as $value) {
$values = explode("|", $value);
$step = array();
foreach ($values as $item) {
// check for key:value
$items = explode(':', $item);
if (count($items) == 1) {
// just a value
$step[] = trim($item);
}
else {
$key = trim($items[0]);
$trim_item = trim($items[1]);
if (strpos($trim_item, '[') === 0) {
// check for array syntax [item1,item2...]
$trim_item = explode(',', substr($trim_item, 1, strlen($trim_item) - 2));
}
$step[$key] = $trim_item;
}
}
$steps[] = $step;
}
}
return $steps;
}