From 316fc89482ce8d2fd6fe2c6be69f5bc3208e1313 Mon Sep 17 00:00:00 2001 From: Tim Otten <totten@civicrm.org> Date: Tue, 30 May 2017 19:03:39 -0700 Subject: [PATCH] hook_civicrm_* - Fix various parameter names This updates the docs to ensure that hook parameters exactly match the names in the code. Prior to 4.7.19, the names of hook-parameters didn't really matter (as long as they were in the right order). In 4.7.19, the names took on extra significance because Symfony-based listeners use objects and fields (e.g. `$event->firstParam`) instead of ordered params (`function($firstParam)`). --- docs/hooks/hook_civicrm_buildProfile.md | 8 ++++---- docs/hooks/hook_civicrm_contactListQuery.md | 6 +++--- docs/hooks/hook_civicrm_optionValues.md | 4 ++-- docs/hooks/hook_civicrm_processProfile.md | 4 ++-- docs/hooks/hook_civicrm_searchProfile.md | 4 ++-- docs/hooks/hook_civicrm_validateProfile.md | 4 ++-- docs/hooks/hook_civicrm_viewProfile.md | 4 ++-- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/docs/hooks/hook_civicrm_buildProfile.md b/docs/hooks/hook_civicrm_buildProfile.md index 1899d8e1..90a5dab5 100644 --- a/docs/hooks/hook_civicrm_buildProfile.md +++ b/docs/hooks/hook_civicrm_buildProfile.md @@ -6,11 +6,11 @@ This hook is called while preparing a profile form. ## Definition - buildProfile($name) + buildProfile($profileName) ## Parameters -- $name - the (machine readable) name of the profile. +- $profileName - the (machine readable) name of the profile. ## Returns @@ -21,9 +21,9 @@ immediately obvious how I can use this. I could do something like this: - function myext_civicrm_buildProfile($name) { + function myext_civicrm_buildProfile($profileName) { - if ($name === 'MyTargetedProfile) { + if ($profileName === 'MyTargetedProfile) { CRM_Core_Resources::singleton()->addScriptFile('org.example.myext', 'some/fancy.js', 100); diff --git a/docs/hooks/hook_civicrm_contactListQuery.md b/docs/hooks/hook_civicrm_contactListQuery.md index 50dc8315..d2e9663f 100644 --- a/docs/hooks/hook_civicrm_contactListQuery.md +++ b/docs/hooks/hook_civicrm_contactListQuery.md @@ -18,7 +18,7 @@ the list of contacts to display. ## Definition - hook_civicrm_contactListQuery( &$query, $name, $context, $id ) + hook_civicrm_contactListQuery( &$query, $queryText, $context, $id ) ## Parameters @@ -29,7 +29,7 @@ the list of contacts to display. - the contact 'data' to display in the autocomplete dropdown (usually contact.sort_name - aliased as 'data') - the contact IDs -- $name - the name string to execute the query against (this is the +- $queryText - the name string to execute the query against (this is the value being typed in by the user) - $context - the context in which this ajax call is being made (for example: 'customfield', 'caseview') @@ -56,7 +56,7 @@ This example limits contacts in my contact reference field lookup $query = " SELECT c.sort_name as data, c.id FROM civicrm_contact c, civicrm_group_contact cg - WHERE c.sort_name LIKE '$name%' + WHERE c.sort_name LIKE '$queryText%' AND cg.group_id IN ( 5 ) AND cg.contact_id = c.id AND cg.status = 'Added' diff --git a/docs/hooks/hook_civicrm_optionValues.md b/docs/hooks/hook_civicrm_optionValues.md index 8078fc80..fcc0f5dc 100644 --- a/docs/hooks/hook_civicrm_optionValues.md +++ b/docs/hooks/hook_civicrm_optionValues.md @@ -12,13 +12,13 @@ hook to add/remove options from the option group. ## Definition ```php -hook_civicrm_optionValues(&$options, $name) +hook_civicrm_optionValues(&$options, $groupName) ``` ## Parameters - array `$options` - the current set of options -- string `$name` - the name of the option group +- string `$groupName` - the name of the option group ## Returns diff --git a/docs/hooks/hook_civicrm_processProfile.md b/docs/hooks/hook_civicrm_processProfile.md index 05888e9a..3b640154 100644 --- a/docs/hooks/hook_civicrm_processProfile.md +++ b/docs/hooks/hook_civicrm_processProfile.md @@ -6,11 +6,11 @@ This hook is called processing a valid profile form submission (e.g. for "civicr ## Definition - processProfile($name) + processProfile($profileName) ## Parameters -- $name - the (machine readable) name of the profile. +- $profileName - the (machine readable) name of the profile. !!! Tip In SQL, this corresponds to the "name" column of table "civicrm_uf_group" diff --git a/docs/hooks/hook_civicrm_searchProfile.md b/docs/hooks/hook_civicrm_searchProfile.md index d8216db6..f7973938 100644 --- a/docs/hooks/hook_civicrm_searchProfile.md +++ b/docs/hooks/hook_civicrm_searchProfile.md @@ -7,11 +7,11 @@ profile). ## Definition - searchProfile($name) + searchProfile($profileName) ## Parameters -- $name - the (machine readable) name of the profile. +- $profileName - the (machine readable) name of the profile. ## Returns diff --git a/docs/hooks/hook_civicrm_validateProfile.md b/docs/hooks/hook_civicrm_validateProfile.md index b961c48a..fbba815f 100644 --- a/docs/hooks/hook_civicrm_validateProfile.md +++ b/docs/hooks/hook_civicrm_validateProfile.md @@ -6,11 +6,11 @@ This hook is called while validating a profile form submission. ## Definition - validateProfile($name) + validateProfile($profileName) ## Parameters -- $name - the (machine readable) name of the profile. +- $profileName - the (machine readable) name of the profile. ## Returns diff --git a/docs/hooks/hook_civicrm_viewProfile.md b/docs/hooks/hook_civicrm_viewProfile.md index 3e3636f7..40bfda32 100644 --- a/docs/hooks/hook_civicrm_viewProfile.md +++ b/docs/hooks/hook_civicrm_viewProfile.md @@ -6,11 +6,11 @@ This hook is called while preparing a read-only profile screen. ## Definition - viewProfile($name) + viewProfile($profileName) ## Parameters -- $name - the (machine readable) name of the profile. +- $profileName - the (machine readable) name of the profile. ## Returns -- GitLab