Make sure that farm_api's implementation of hook_restws_request_alter() runs before restws_file's.
This commit is contained in:
parent
50049440b0
commit
858b7f9900
|
@ -54,6 +54,32 @@ function farm_api_info() {
|
|||
drupal_json_output($info);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_module_implements_alter().
|
||||
*/
|
||||
function farm_api_module_implements_alter(&$implementations, $hook) {
|
||||
|
||||
// We only want to alter hook_restws_request_alter() implementations.
|
||||
if ($hook != 'restws_request_alter') {
|
||||
return;
|
||||
}
|
||||
|
||||
// If either restws_file or farm_api don't implement the hook, bail.
|
||||
$modules = array(
|
||||
'restws_file',
|
||||
'farm_api',
|
||||
);
|
||||
foreach ($modules as $module) {
|
||||
if (!array_key_exists($module, $implementations)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Put farm_api's hook above restws_file's hook, so that our field aliasing
|
||||
// happens first.
|
||||
$implementations = array('farm_api' => $implementations['farm_api']) + $implementations;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_restws_request_alter().
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue