|
- <?php
-
- namespace domain\Setting\SettingDetails\Admin;
-
- use domain\Setting\SettingDefinition;
- use domain\Setting\SettingDetails\Admin\AlertMessage\AdminAlertMessageIconSetting;
- use domain\Setting\SettingDetails\Admin\AlertMessage\AdminAlertMessageSetting;
- use domain\Setting\SettingDetails\Admin\AlertMessage\AdminAlertMessageTitleSetting;
- use domain\Setting\SettingDetails\Admin\AlertMessage\AdminAlertMessageTypeSetting;
- use domain\Setting\SettingDetails\Admin\AlertMessage\AdminAlertMessageUpdatedAtSetting;
- use domain\Setting\SettingDetails\Admin\AlertMessage\AdminSupportAlertMessageDisplaySetting;
- use domain\Setting\SettingDetails\Admin\AlertMessage\AdminSupportAlertMessageIconSetting;
- use domain\Setting\SettingDetails\Admin\AlertMessage\AdminSupportAlertMessageSetting;
- use domain\Setting\SettingDetails\Admin\AlertMessage\AdminSupportAlertMessageTitleSetting;
- use domain\Setting\SettingDetails\Admin\AlertMessage\AdminSupportAlertMessageTypeSetting;
- use domain\Setting\SettingDetails\Admin\General\AdministratorEmailAdminSetting;
- use domain\Setting\SettingDetails\Admin\General\AdministratorPhoneNumberAdminSetting;
- use domain\Setting\SettingDetails\Admin\General\BulkMailerAdminSetting;
- use domain\Setting\SettingDetails\Admin\General\ForumFlarumUrlAdminSetting;
- use domain\Setting\SettingDetails\Admin\General\MailerAdminSetting;
- use domain\Setting\SettingDetails\Admin\General\MaximumNumberProducersAdminSetting;
- use domain\Setting\SettingDetails\Admin\General\SupportOnlineAdminSetting;
- use domain\Setting\SettingDetails\Admin\AlertMessage\AdminAlertMessageDisplaySetting;
-
- class AdminSettingDefinition extends SettingDefinition
- {
- const SECTION_GENERAL = 'general';
- const SUBSECTION_GENERAL = 'general.main';
-
- const SECTION_ALERT_MESSAGE = 'alertmessage';
- const SUBSECTION_ALERT_MESSAGE_GLOBAL = 'alertmessage.global';
- const SUBSECTION_ALERT_MESSAGE_SUPPORT = 'alertmessage.support';
-
- public function getSettingDetails(): array
- {
- return [
- self::SECTION_GENERAL => [
- self::SUBSECTION_GENERAL => [
- new SupportOnlineAdminSetting(),
- new AdministratorEmailAdminSetting(),
- new AdministratorPhoneNumberAdminSetting(),
- new MaximumNumberProducersAdminSetting(),
- new ForumFlarumUrlAdminSetting(),
- new MailerAdminSetting(),
- new BulkMailerAdminSetting(),
- ]
- ],
- self::SECTION_ALERT_MESSAGE => [
- self::SUBSECTION_ALERT_MESSAGE_GLOBAL => [
- new AdminAlertMessageDisplaySetting(),
- new AdminAlertMessageTypeSetting(),
- new AdminAlertMessageIconSetting(),
- new AdminAlertMessageTitleSetting(),
- new AdminAlertMessageSetting(),
- new AdminAlertMessageUpdatedAtSetting(),
- ],
- self::SUBSECTION_ALERT_MESSAGE_SUPPORT => [
- new AdminSupportAlertMessageDisplaySetting(),
- new AdminSupportAlertMessageTypeSetting(),
- new AdminSupportAlertMessageIconSetting(),
- new AdminSupportAlertMessageTitleSetting(),
- new AdminSupportAlertMessageSetting(),
- ],
- ]
- ];
- }
-
- public function getSectionLabels(): array
- {
- return [
- self::SECTION_GENERAL => 'General',
- self::SUBSECTION_GENERAL => 'General',
-
- self::SECTION_ALERT_MESSAGE => 'Message d\'alerte',
- self::SUBSECTION_ALERT_MESSAGE_GLOBAL => 'Global',
- self::SUBSECTION_ALERT_MESSAGE_SUPPORT => 'Support'
- ];
- }
-
- public function getSectionsArray(): array
- {
- $sectionsArray = [];
-
- foreach($this->getSettingDetails() as $sectionName => $subsectionsArray) {
- $sectionsArray[] = [
- 'name' => $sectionName,
- 'nameDisplay' => $this->getSectionLabelBySectionName($sectionName),
- ];
- }
-
- return $sectionsArray;
- }
-
- public function getSettingDetailsFlat(): array
- {
- $settingDetailsFlatArray = [];
-
- foreach($this->getSettingDetails() as $sectionsArray) {
- foreach($sectionsArray as $subsectionsArray) {
- foreach($subsectionsArray as $settingDetail) {
- $settingDetailsFlatArray[] = $settingDetail;
- }
- }
- }
-
- return $settingDetailsFlatArray;
- }
-
- public function getSectionLabelBySectionName(string $sectionName): string
- {
- return $this->getSectionLabels()[$sectionName];
- }
- }
|