From f17b96a65de6bc9bb7342355bdec3614326f3fba Mon Sep 17 00:00:00 2001 From: VitorVieira20 Date: Tue, 17 Dec 2024 10:30:25 +0000 Subject: [PATCH] feature: Allow hiding specific fields in the registration form (#367) --- Pages/RegistrationPage.php | 3 +++ config/config.dist.php | 3 +++ lib/Config/ConfigKeys.php | 3 +++ tpl/register.tpl | 6 ++++++ 4 files changed, 15 insertions(+) diff --git a/Pages/RegistrationPage.php b/Pages/RegistrationPage.php index d14c1de4a..68d3e56c1 100644 --- a/Pages/RegistrationPage.php +++ b/Pages/RegistrationPage.php @@ -78,6 +78,9 @@ public function ProcessPageLoad() $this->Set('RequirePhone', Configuration::Instance()->GetSectionKey(ConfigSection::REGISTRATION, ConfigKeys::REGISTRATION_REQUIRE_PHONE, new BooleanConverter())); $this->Set('RequirePosition', Configuration::Instance()->GetSectionKey(ConfigSection::REGISTRATION, ConfigKeys::REGISTRATION_REQUIRE_POSITION, new BooleanConverter())); $this->Set('RequireOrganization', Configuration::Instance()->GetSectionKey(ConfigSection::REGISTRATION, ConfigKeys::REGISTRATION_REQUIRE_ORGANIZATION, new BooleanConverter())); + $this->Set('HidePhone', Configuration::Instance()->GetSectionKey(ConfigSection::REGISTRATION, ConfigKeys::REGISTRATION_HIDE_PHONE, new BooleanConverter())); + $this->Set('HidePosition', Configuration::Instance()->GetSectionKey(ConfigSection::REGISTRATION, ConfigKeys::REGISTRATION_HIDE_POSITION, new BooleanConverter())); + $this->Set('HideOrganization', Configuration::Instance()->GetSectionKey(ConfigSection::REGISTRATION, ConfigKeys::REGISTRATION_HIDE_ORGANIZATION, new BooleanConverter())); $this->_presenter->PageLoad(); diff --git a/config/config.dist.php b/config/config.dist.php index 8acc84207..c6acacb17 100644 --- a/config/config.dist.php +++ b/config/config.dist.php @@ -209,6 +209,9 @@ $conf['settings']['registration']['require.phone'] = 'false'; $conf['settings']['registration']['require.position'] = 'false'; $conf['settings']['registration']['require.organization'] = 'false'; +$conf['settings']['registration']['hide.phone'] = 'false'; //Hide phone field when 'true', but show it when the phone is required +$conf['settings']['registration']['hide.position'] = 'false'; //Hide position field when 'true', but show it when the phone is required +$conf['settings']['registration']['hide.organization'] = 'false'; //Hide organization field when 'true', but show it when the phone is required /** * Error logging */ diff --git a/lib/Config/ConfigKeys.php b/lib/Config/ConfigKeys.php index 8f3c7800d..70698fce6 100644 --- a/lib/Config/ConfigKeys.php +++ b/lib/Config/ConfigKeys.php @@ -159,6 +159,9 @@ class ConfigKeys public const REGISTRATION_REQUIRE_PHONE = 'require.phone'; public const REGISTRATION_REQUIRE_ORGANIZATION = 'require.organization'; public const REGISTRATION_REQUIRE_POSITION = 'require.position'; + public const REGISTRATION_HIDE_PHONE = 'hide.phone'; + public const REGISTRATION_HIDE_ORGANIZATION = 'hide.organization'; + public const REGISTRATION_HIDE_POSITION = 'hide.position'; public const LOGGING_FOLDER = 'folder'; public const LOGGING_LEVEL = 'level'; diff --git a/tpl/register.tpl b/tpl/register.tpl index 112ca882c..96b13d984 100644 --- a/tpl/register.tpl +++ b/tpl/register.tpl @@ -133,6 +133,7 @@ + {if $RequirePhone || !$HidePhone}
+ {/if} + {if $RequireOrganization || !$HideOrganization}
+ {/if} + {if $RequirePosition || !$HidePosition}
+ {/if}
{if $Attributes|default:array()|count > 0}