You are here

function domain_entity_commerce_product_reference_default_delta_alter in Domain Access Entity 7

Implements hook_commerce_product_reference_default_delta_alter().

File

./domain_entity.module, line 692
Defines field (e.g. domain_entity) for entities, and access query alter.

Code

function domain_entity_commerce_product_reference_default_delta_alter(&$delta, $products) {
  $allowed_entity_types = domain_entity_allowed_entity_types();
  if (!in_array('commerce_product', array_keys($allowed_entity_types))) {
    return;
  }
  foreach ($products as $new_delta => $product) {
    if (!empty($product)) {
      $delta = $new_delta;
      return;
    }
  }
}