There's no way, currently to get the machine name of a task status.
Closest thing is
/**
* Traslate a task status code into a css class.
*/
function hosting_task_status_class($status = NULL) {
Branch incoming adds hosting_task_status_name() and modifies hosting_task_status_class() to implement it:
/**
* Return a machine name for each state.
*/
function hosting_task_status_name($hosting_task_status = NULL) {
$codes = array(
HOSTING_TASK_SUCCESS => 'success',
HOSTING_TASK_QUEUED => 'queued',
HOSTING_TASK_ERROR => 'error',
HOSTING_TASK_PROCESSING => 'processing',
HOSTING_TASK_WARNING => 'warning',
);
if (!is_null($hosting_task_status) && isset($codes[$hosting_task_status])) {
return $codes[$hosting_task_status];
}
elseif (!is_null($hosting_task_status) && !isset($codes[$hosting_task_status])) {
return '';
}
else {
return $codes;
}
}
/**
* Return a css class from a hosting task status integer value.
*/
function hosting_task_status_class($status = NULL) {
if (!is_null($status) && $name = hosting_task_status_name($status)) {
return 'hosting-' . $name;
}
else {
return '';
}
}
Comments
Comment #4
jon pughComment #6
jon pughComment #8
jon pughComment #9
helmo commentedLooks good
Comment #10
jon pughHelmo can you confirm the classes on the task tables are right? Look at queued tasks, make sure they have the grey background and icon.
I thought I saw a regression....
Comment #12
jon pughThanks, Helmo, merged.