diff --git a/modules/candidate_parameters/php/module.class.inc b/modules/candidate_parameters/php/module.class.inc index bcfe5f3e094..0ed5bc0e371 100644 --- a/modules/candidate_parameters/php/module.class.inc +++ b/modules/candidate_parameters/php/module.class.inc @@ -42,6 +42,10 @@ class Module extends \Module return []; } + if (!\NDB_Factory::singleton()->settings()->consentEnabled()) { + return []; + } + // The candidate getConsents only returns the types of // consents that the candidate has saved, we want to // summarize all of the types configured in the database. diff --git a/php/libraries/Settings.class.inc b/php/libraries/Settings.class.inc index 352c1401949..e67772f820f 100644 --- a/php/libraries/Settings.class.inc +++ b/php/libraries/Settings.class.inc @@ -164,5 +164,17 @@ class Settings return false; } + /** + * Determines whether the useConsent configuration setting is + * enabled + * + * @return bool True if the useConsent setting is enabled + */ + function consentEnabled(): bool + { + return \NDB_Factory::singleton()->config()->settingEnabled( + 'useConsent' + ); + } }