You are here

function commerce_file_license_state_get_title in Commerce File 7

Returns the human readable title of any or all states.

Parameters

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

Return value

Either an array of all 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.

1 call to commerce_file_license_state_get_title()
commerce_file_license_state_options_list in includes/commerce_file.entities.inc
Wraps commerce_file_license_state_get_title() for use by the Entity module.

File

includes/commerce_file.entities.inc, line 424
Handles file licenses and file license logs

Code

function commerce_file_license_state_get_title($name = NULL) {
  $states = commerce_file_license_states();

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

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

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