You are here

function commerce_order_state_get_title in Commerce Core 7

Returns the human readable title of any or all order states.

Parameters

$name: Optional parameter specifying the name of the order state whose title should be return.

Return value

Either an array of all order state titles keyed by name or a string containing the human readable title for the specified state. If a state is specified that does not exist, this function returns FALSE.

6 calls to commerce_order_state_get_title()
commerce_order_handler_filter_order_state::get_value_options in modules/order/includes/views/handlers/commerce_order_handler_filter_order_state.inc
Child classes should be used to override this function and set the 'value options', unless 'options callback' is defined as a valid function or static public method to generate these values.
commerce_order_handler_filter_order_status::get_value_options in modules/order/includes/views/handlers/commerce_order_handler_filter_order_status.inc
Child classes should be used to override this function and set the 'value options', unless 'options callback' is defined as a valid function or static public method to generate these values.
commerce_order_order_form in modules/order/includes/commerce_order.forms.inc
Form callback: create or edit an order.
commerce_order_state_options_list in modules/order/commerce_order.module
Wraps commerce_order_state_get_title() for use by the Entity module.
commerce_order_status_options_list in modules/order/commerce_order.module
Wraps commerce_order_status_get_title() for use by the Entity module.

... See full list

File

modules/order/commerce_order.module, line 1062
Defines the core Commerce order entity and API functions to manage orders and interact with them.

Code

function commerce_order_state_get_title($name = NULL) {
  $order_states = commerce_order_states();

  // Return a state title if specified and it exists.
  if (!empty($name)) {
    if (isset($order_states[$name])) {
      return $order_states[$name]['title'];
    }
    else {

      // Return FALSE if it does not exist.
      return FALSE;
    }
  }

  // Otherwise turn the array values into the status title only.
  foreach ($order_states as $key => $value) {
    $order_states[$key] = $value['title'];
  }
  return $order_states;
}