function commerce_discount_offer_types in Commerce Discount 7
Return an array of all defined discount offer types.
Return value
array The array of types, keyed by type name.
6 calls to commerce_discount_offer_types()
- CommerceDiscountOfferInlineEntityFormController::entityForm in includes/
commerce_discount_offer.inline_entity_form.inc - Returns the entity form to be shown through the IEF widget.
- commerce_discount_build_discount_rules in ./
commerce_discount.module - Build the rules configuration for the given discounts.
- commerce_discount_entity_info in ./
commerce_discount.module - Implements hook_entity_info().
- commerce_discount_offer_type in ./
commerce_discount.module - Loads the data for a specific discount offer type.
- commerce_discount_offer_type_get_name in ./
commerce_discount.module - Returns the human readable name of any or all discount offer types.
File
- ./
commerce_discount.module, line 776 - Defines the discount and discount offer entities, bundles and functionality.
Code
function commerce_discount_offer_types() {
$offer_types =& drupal_static(__FUNCTION__);
if (!isset($offer_types)) {
$offer_types = array();
foreach (module_implements('commerce_discount_offer_type_info') as $module) {
foreach (module_invoke($module, 'commerce_discount_offer_type_info') as $type => $info) {
$info += array(
// Remember the providing module.
'module' => $module,
);
$offer_types[$type] = $info;
}
}
// Allow the type info to be altered by other modules.
drupal_alter('commerce_discount_offer_type_info', $offer_types);
}
return $offer_types;
}