You are here

function commerce_product_uri in Commerce Core 7

Entity uri callback: gives modules a chance to specify a path for a product.

1 call to commerce_product_uri()
commerce_product_ui_product_uri in modules/product/commerce_product_ui.module
Entity uri callback: points to the edit form of the given product if no other URI is specified.
1 string reference to 'commerce_product_uri'
commerce_product_entity_info in modules/product/commerce_product.module
Implements hook_entity_info().

File

modules/product/commerce_product.module, line 166
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_uri($product) {

  // Allow modules to specify a path, returning the first one found.
  foreach (module_implements('commerce_product_uri') as $module) {
    $uri = module_invoke($module, 'commerce_product_uri', $product);

    // If the implementation returned data, use that now.
    if (!empty($uri)) {
      return $uri;
    }
  }
  return NULL;
}