You are here

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

Returns an array of line item type arrays keyed by type.

1 call to merci_line_item_types_info()
merci_line_item_enable in merci_line_item/merci_line_item.module
Implements hook_enable().

File

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

Code

function merci_line_item_types_info() {

  // First check the static cache for a line item types array.
  $line_item_types =& drupal_static(__FUNCTION__);

  // If it did not exist, fetch the types now.
  if (!isset($line_item_types)) {
    $line_item_types = module_invoke_all('merci_line_item_type_info');
    drupal_alter('merci_line_item_type_info', $line_item_types);
    foreach ($line_item_types as $type => &$line_item_type) {
      $defaults = array(
        'type' => $type,
        'base' => $type,
        'callbacks' => array(),
      );
      $line_item_type += $defaults;

      // Merge in default callbacks.
      foreach (array(
        'configuration',
        'title',
        'add_form',
        'add_form_submit',
      ) as $callback) {
        if (!isset($line_item_type['callbacks'][$callback])) {
          $line_item_type['callbacks'][$callback] = $line_item_type['base'] . '_' . $callback;
        }
      }
    }
  }
  return $line_item_types;
}