From 9fdf2f171981f50e3723fb903a7f74253494e505 Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Sat, 29 Feb 2020 10:12:05 +1100 Subject: [PATCH] [Feature] Add in new hook alterUFFields to allow extensions to modify which fields can be added to a profile --- CRM/Core/BAO/UFField.php | 1 + CRM/Utils/Hook.php | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/CRM/Core/BAO/UFField.php b/CRM/Core/BAO/UFField.php index 828db1f7e3..84fbeb20a8 100644 --- a/CRM/Core/BAO/UFField.php +++ b/CRM/Core/BAO/UFField.php @@ -1031,6 +1031,7 @@ SELECT id unset($fields[$value['field_type']][$key]); } + CRM_Utils_Hook::alterUFFields($fields); return $fields; } diff --git a/CRM/Utils/Hook.php b/CRM/Utils/Hook.php index 31663cacf5..982da09c58 100644 --- a/CRM/Utils/Hook.php +++ b/CRM/Utils/Hook.php @@ -2631,4 +2631,17 @@ abstract class CRM_Utils_Hook { ); } + /** + * Allow extensions to modify the array of acceptable fields to be included on profiles + * @param array $fields + * @return mixed + */ + public static function alterUFFields(&$fields) { + return self::singleton()->invoke(['fields'], + $fields, self::$_nullObject, self::$_nullObject, + self::$_nullObject, self::$_nullObject, self::$_nullObject, + 'civicrm_alterUFFields' + ); + } + } -- 2.25.1