Working on a PR to add pre
and post
hooks for the UFGroup
entity, I looked for existing examples of entities that invoke these hooks with the 'view' $op (documented in the 'parameters' section for hook_civicrm_pre and hook_civirm_post). But I'm not finding any. This ack-grep output, for example:
$ cd /opt/buildkit/build/drupal-clean/web/sites/all/modules/civicrm
$ ack 'Hook::post\b.+\bview\b'
$ ack 'Hook::pre\b.+\bview\b'
$
Likewise, actually getting a hook implementation to fire on this op in an extension is failing for all of the entities I've tried (probably 10 or so of the more common ones like Contact, ContributionPage, etc.):
/**
* Implements hook_civicrm_pre().
*
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_pre
*/
function myextension_civicrm_pre($op, $objectName, $id, &$params) {
if ($op == 'view') {
die('op is view');
}
}
Can anyone name an entity in CiviCRM where this op is used in either of these hooks? If not, I'm inclined to submit a documentation patch to remove it from the docs.
Also reference: Is there a hook that will be called before each database read?