function commerce_coupon_apply_access_query_substitute in Commerce Coupon 7.2
Call implementations of hook_commerce_coupon_access_query_substitute.
If no implementing modules found, apply the standard commerce_entity_access_query_alter function.
Parameters
QueryAlterableInterface $query: The query object that we are operating on.
string $coupon_alias: A table alias that represents the commerce_coupon table.
1 call to commerce_coupon_apply_access_query_substitute()
File
- ./
commerce_coupon.module, line 399 - Provides coupon functionality for Drupal Commerce.
Code
function commerce_coupon_apply_access_query_substitute(QueryAlterableInterface $query, $coupon_alias) {
// Only modules that need to change the query itself (see Commerce Coupon
// User) should implement this. Simple changes to just the query conditions
// can be implemented using
// hook_commerce_entity_access_condition_commerce_coupon_alter().
$modules = module_implements('commerce_coupon_access_query_substitute');
if ($modules) {
foreach ($modules as $module) {
// Each implementing module gets the original query as its argument to
// avoid having to worry about undoing changes that previous implementers
// add in. The last implementing module is the "winner".
$new_query = module_invoke($module, 'commerce_coupon_access_query_substitute', $query, $coupon_alias);
}
if (isset($new_query)) {
$query = $new_query;
}
}
else {
commerce_entity_access_query_alter($query, 'commerce_coupon', $coupon_alias);
}
}