Skip to content

Commit

Permalink
Merge pull request #22933 from colemanw/fixQueryHook
Browse files Browse the repository at this point in the history
Fix backward-compatability for new method in CRM_Contact_BAO_Query_Hook
  • Loading branch information
demeritcowboy authored Mar 13, 2022
2 parents f36f2db + 095060e commit e43ca55
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions CRM/Contact/BAO/Query/Hook.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,22 @@ public function setAdvancedSearchPaneTemplatePath(&$paneTemplatePathArray, $type
}

/**
* This gives the opportunity for a single hook to return default fields.
*
* It only runs if no core components have defaults for this $mode.
* The expectation is that only one hook will handle this mode, so just
* the first one to return a value is used.
*
* @param $mode
* @return array|null
*/
public function getDefaultReturnProperties($mode) {
foreach (self::getSearchQueryObjects() as $obj) {
$properties = $obj::defaultReturnProperties($mode);
if ($properties) {
return $properties;
foreach ($this->getSearchQueryObjects() as $obj) {
if (method_exists($obj, 'defaultReturnProperties')) {
$properties = $obj::defaultReturnProperties($mode);
if ($properties) {
return $properties;
}
}
}
return NULL;
Expand Down

0 comments on commit e43ca55

Please sign in to comment.