|
- <?php
-
- namespace common\logic\Setting\SettingDetails\Admin;
-
- use common\logic\Setting\SettingDefinition;
- use common\logic\Setting\SettingDetails\Admin\General\AdministratorEmailAdminSetting;
- use common\logic\Setting\SettingDetails\Admin\General\AdministratorPhoneNumberAdminSetting;
-
- class AdminSettingDefinition extends SettingDefinition
- {
- const SECTION_GENERAL = 'general';
- const SUBSECTION_GENERAL = 'general.main';
-
- public function getSettingDetails(): array
- {
- return [
- self::SECTION_GENERAL => [
- self::SUBSECTION_GENERAL => [
- new AdministratorEmailAdminSetting,
- new AdministratorPhoneNumberAdminSetting,
- ]
- ],
- ];
- }
-
- public function getSectionLabels(): array
- {
- return [
- self::SECTION_GENERAL => 'General',
- self::SUBSECTION_GENERAL => 'General',
- ];
- }
-
- 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];
- }
- }
|