This repository has been archived by the owner on Oct 8, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #668 from pradpnayak/entityRefFilters
Added doc for hook_civicrm_entityRefFilters
- Loading branch information
Showing
2 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# hook_civicrm_entityRefFilters | ||
|
||
## Summary | ||
|
||
This hook is called when filters and create links for entityRef field is build. | ||
|
||
## Definition | ||
|
||
hook_civicrm_entityRefFilters(&$filters, &$links) | ||
|
||
## Parameters | ||
|
||
- array $filters - reference to list of filters | ||
- array $links - reference to list of create links | ||
|
||
## Returns | ||
|
||
## Example | ||
|
||
/** | ||
* Implements hook_civicrm_entityRefFilters(). | ||
* | ||
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_entityRefFilters | ||
*/ | ||
function modulename_civicrm_entityRefFilters(&$filters, &$links) { | ||
// Add New Staff link on entityRef field of contact | ||
$links['Contact'][] = [ | ||
'label' => ts('New Staff'), | ||
'url' => CRM_Utils_System::url('/civicrm/profile/create', 'reset=1&context=dialog&gid=5'), | ||
'type' => 'Individual', | ||
'icon' => 'fa-user', | ||
]; | ||
|
||
// Add Do not email filter on contact entity ref field. | ||
$filters['Contact'][] = [ | ||
'key' => 'do_not_email', | ||
'value' => ts('Do Not Email'), | ||
]; | ||
// Add Marital status filter on contact entity ref field. | ||
$filters['Contact'][] = [ | ||
'key' => 'custom_2', | ||
'value' => ts('Marital status'), | ||
]; | ||
|
||
// Add custom field of address as filter on contact entity ref field. | ||
$filters['Contact'][] = [ | ||
'key' => 'custom_34', | ||
'value' => ts('Belongs to'), | ||
'entity' => 'Address', | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters