function commerce_order_status_get_title in Commerce Core 7
Returns the human readable title of any or all order statuses.
Parameters
$name: Optional parameter specifying the name of the order status whose title to return.
Return value
Either an array of all order status titles keyed by the status_id or a string containing the human readable title for the specified status. If a status is specified that does not exist, this function returns FALSE.
3 calls to commerce_order_status_get_title()
- commerce_order_handler_field_order_status::render in modules/
order/ includes/ views/ handlers/ commerce_order_handler_field_order_status.inc - Render the field.
- commerce_order_order_form in modules/
order/ includes/ commerce_order.forms.inc - Form callback: create or edit an order.
- commerce_order_tokens in modules/
order/ commerce_order.tokens.inc - Implements hook_tokens().
File
- modules/
order/ commerce_order.module, line 1197 - Defines the core Commerce order entity and API functions to manage orders and interact with them.
Code
function commerce_order_status_get_title($name = NULL) {
$order_statuses = commerce_order_statuses();
// Return a status title if specified and it exists.
if (!empty($name)) {
if (isset($order_statuses[$name])) {
return $order_statuses[$name]['title'];
}
else {
// Return FALSE if it does not exist.
return FALSE;
}
}
// Otherwise turn the array values into the status title only.
foreach ($order_statuses as $key => $value) {
$order_statuses[$key] = $value['title'];
}
return $order_statuses;
}