function commerce_product_configure_product_fields in Commerce Core 7
Configures the fields on product types provided by other modules.
Parameters
$modules: An array of module names whose product type fields should be configured; if left NULL, will default to all modules that implement hook_commerce_product_type_info().
1 call to commerce_product_configure_product_fields()
- commerce_product_modules_enabled in modules/
product/ commerce_product.module - Implements hook_modules_enabled().
File
- modules/
product/ commerce_product.module, line 347 - Defines the core Commerce product entity, including the entity itself, the bundle definitions (product types), and various API functions to manage products and interact with them through forms and autocompletes.
Code
function commerce_product_configure_product_fields($modules = NULL) {
// If no modules array is passed, recheck the fields for all product types
// defined by enabled modules.
if (empty($modules)) {
$modules = module_implements('commerce_product_type_info');
}
// Reset the product type cache to get types added by newly enabled modules.
commerce_product_types_reset();
// Loop through all the enabled modules.
foreach ($modules as $module) {
// If the module implements hook_commerce_product_type_info()...
if (module_hook($module, 'commerce_product_type_info')) {
$product_types = module_invoke($module, 'commerce_product_type_info');
// Loop through and configure the product types defined by the module.
foreach ($product_types as $type => $product_type) {
commerce_product_configure_product_type($type);
}
}
}
}