From 6a335e0661289e37a78cad528c800457d4f69cf0 Mon Sep 17 00:00:00 2001 From: Tim Otten <totten@civicrm.org> Date: Mon, 18 Sep 2023 22:06:54 -0700 Subject: [PATCH] pcp.user.actions - Decompose deviant list of links The problem is that: * `hook_links('pcp.user.actions')` fires with a malformed set links * The malformed set of links has been specifically encoded into unit tests So fixing the bad links would likely break some consumer. (I don't see the consumer in my copy of `universe`, but if someone wrote the test, then they must've really meant it...) This patch adds alternative variants (`hook_links('pcp.user.actions.add')` and `hook_links('pcp.user.actions.all')`) which should replace it. --- CRM/PCP/BAO/PCP.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CRM/PCP/BAO/PCP.php b/CRM/PCP/BAO/PCP.php index 3f78c95392..5c504f8441 100644 --- a/CRM/PCP/BAO/PCP.php +++ b/CRM/PCP/BAO/PCP.php @@ -344,7 +344,11 @@ WHERE pcp.id = %1 AND cc.contribution_status_id = %2 AND cc.is_test = 0"; ], ]; + // pcp.user.actions emits a malformed set of $links. But it is locked-in via unit-test, so we'll grandfather + // the bad one and fire new variants that are well-formed. CRM_Utils_Hook::links('pcp.user.actions', 'Pcp', $pcpId, self::$_pcpLinks); + CRM_Utils_Hook::links('pcp.user.actions.add', 'Pcp', $pcpId, self::$_pcpLinks['add']); + CRM_Utils_Hook::links('pcp.user.actions.all', 'Pcp', $pcpId, self::$_pcpLinks['all']); } return self::$_pcpLinks; } -- 2.25.1