Details
-
Type: Improvement
-
Status: Done/Fixed
-
Priority: Trivial
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.4.0
-
Fix Version/s: 4.5
-
Component/s: Core CiviCRM
-
Labels:
Description
There's a hook called hook_civicrm_links, and it handles the links that are created by CRM_Core_Action::formLink, but only if the following parameters are passed there (that are in turn passed to the hook):
- $op - the operation (pretty open-ended)
- $objectName - Contact, Activity, etc.
- $objectId - the ID of the object
The other param passed there is $links, the array of actual links.
So far, this is only run in three places:
- view.contact.activity - the links at the top of the contact summary page
- view.contact.userDashboard - the dashboard links for related contacts
- create.new.shorcuts [sic] - the "Create New" dropdown on the left
In most search results, CRM_Core_Action::formLink is used to create the links at the end of each row, but not enough params are passed to it to be able to use the hook. However, in most cases, we do know the relevant information--it just isn't passed.
In most cases, it just needs a meaningful operation name "contact.selector.row' or 'contributionPage.row.onlineContributionLinks'; the object name and ID are usually handy.
I'd have done this already if there weren't 100 spots where CRM_Core_Action::formLink is called; this'll just be a rainy-day project. Comments and suggestions welcome.