Warning: Missing argument 4 for node_render_cache_entity_hash_alter(), called in [..]/includes/module.inc on line 1056 and defined in node_render_cache_entity_hash_alter() (line 159 of [..]/modules/render_cache/modules/render_cache_entity/render_cache_entity.module).
This is because drupal_alter() ignores the $context3 argument.
In RenderCacheControllerBase:
protected function alter($type, &$data, &$context1 = NULL, &$context2 = NULL, &$context3 = NULL) {
drupal_alter('render_cache_' . $this->getType() . '_' . $type, $data, $context1, $context2, $context3);
}
In drupal_alter():
foreach ($functions[$cid] as $function) {
$function($data, $context1, $context2);
}
In render_cache_entity.module:
/**
* Implements hook_render_cache_entity_hash_alter().
*/
function node_render_cache_entity_hash_alter(&$hash, $entity, $cache_info, $context) {
..
An alternative can be to provide a custom implementation of drupal_alter(), or to restructure the arguments.
Comments
Comment #1
donquixote commentedSolution:
drupal_alter() is unnecessarily complex, allowing the $type argument to be an array of hook suggestions.
Making a custom version of that is a lot easier if we assume $type to always be a string. This also removes the need for extra caching, since module_implements() already covers that.
Btw, what about some docblock here and there? :)
The alter() method has an @inheritdoc, but then the base method (in the interface) has nothing..
Comment #2
donquixote commentedComment #3
donquixote commentedComment #4
donquixote commentedAnd this was again due to an older version of Drupal I had on localhost.
Sorry for the noise.