You are here

function commerce_file_license_type_get_name in Commerce File 7

Returns the human readable name of any or all entity types.

Parameters

$type: Optional parameter specifying the type whose name to return.

Return value

Either an array of all entity type names keyed by the machine name or a string containing the human readable name for the specified type. If a type is specified that does not exist, this function returns FALSE.

1 call to commerce_file_license_type_get_name()
commerce_file_license_type_options_list in includes/commerce_file.entities.inc
Wraps commerce_file_license_type_get_name() for the Entity module.

File

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

Code

function commerce_file_license_type_get_name($type = NULL) {
  $names = array();
  $entity = entity_get_info(COMMERCE_FILE_LICENSE_ENTITY_NAME);
  foreach ($entity['bundles'] as $key => $value) {
    $names[$key] = $value['label'];
  }
  if (empty($type)) {
    return $names;
  }
  if (empty($names[$type])) {
    return check_plain($type);
  }
  else {
    return $names[$type];
  }
}