function workflow_requirements in Workflow 7
Same name and namespace in other branches
- 8 workflow.install \workflow_requirements()
- 7.2 workflow.install \workflow_requirements()
Implements hook_requirements(). Let admins know that Workflow is in use.
File
- ./
workflow.module, line 1001 - Support workflows made up of arbitrary states.
Code
function workflow_requirements($phase) {
$requirements = array();
switch ($phase) {
case 'runtime':
$types = db_query('SELECT wid, type FROM {workflow_type_map} WHERE wid <> 0 ORDER BY type')
->fetchAllKeyed();
// If there are no types, then just bail.
if (count($types) == 0) {
return;
}
// Let's make it look nice.
if (count($types) == 1) {
$type_list = current($types);
}
else {
$last = array_pop($types);
if (count($types) > 2) {
$type_list = implode(', ', $types) . ', and ' . $last;
}
else {
$type_list = current($types) . ' and ' . $last;
}
}
$requirements['workflow'] = array(
'title' => t('Workflow'),
'value' => t('Workflow is active on the @types content types.', array(
'@types' => $type_list,
)),
'severity' => REQUIREMENT_OK,
);
return $requirements;
}
}