You are here

function merci_line_item_type_get_name in MERCI (Manage Equipment Reservations, Checkout and Inventory) 7.3

Returns the human readable name of any or all line item types.

Parameters

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

Return value

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

3 calls to merci_line_item_type_get_name()
merci_line_item_handler_field_line_item_type::render in merci_line_item/includes/views/handlers/merci_line_item_handler_field_line_item_type.inc
Render the field.
merci_line_item_handler_filter_line_item_type::get_value_options in merci_line_item/includes/views/handlers/merci_line_item_handler_filter_line_item_type.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.
merci_line_item_handler_filter_number_reserved::get_value_options in merci_line_item/includes/views/handlers/merci_line_item_handler_filter_number_reserved.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.

File

merci_line_item/merci_line_item.module, line 629
Defines the core MERCI line item entity and API functions interact with line items.

Code

function merci_line_item_type_get_name($type = NULL) {
  $line_item_types = merci_line_item_types();

  // Return a type name if specified and it exists.
  if (!empty($type)) {
    if (isset($line_item_types[$type])) {
      return $line_item_types[$type]->name;
    }
    else {

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

  // Otherwise turn the array values into the type name only.
  $line_item_type_names = array();
  foreach ((array) $line_item_types as $key => $value) {
    $line_item_type_names[$key] = $value->name;
  }
  return $line_item_type_names;
}