Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

67 lines
1.9KB

  1. <?php
  2. namespace common\logic\Setting\SettingDetails\Admin;
  3. use common\logic\Setting\SettingDefinition;
  4. use common\logic\Setting\SettingDetails\Admin\General\AdministratorEmailAdminSetting;
  5. use common\logic\Setting\SettingDetails\Admin\General\AdministratorPhoneNumberAdminSetting;
  6. class AdminSettingDefinition extends SettingDefinition
  7. {
  8. const SECTION_GENERAL = 'general';
  9. const SUBSECTION_GENERAL = 'general.main';
  10. public function getSettingDetails(): array
  11. {
  12. return [
  13. self::SECTION_GENERAL => [
  14. self::SUBSECTION_GENERAL => [
  15. new AdministratorEmailAdminSetting,
  16. new AdministratorPhoneNumberAdminSetting,
  17. ]
  18. ],
  19. ];
  20. }
  21. public function getSectionLabels(): array
  22. {
  23. return [
  24. self::SECTION_GENERAL => 'General',
  25. self::SUBSECTION_GENERAL => 'General',
  26. ];
  27. }
  28. public function getSectionsArray(): array
  29. {
  30. $sectionsArray = [];
  31. foreach($this->getSettingDetails() as $sectionName => $subsectionsArray) {
  32. $sectionsArray[] = [
  33. 'name' => $sectionName,
  34. 'nameDisplay' => $this->getSectionLabelBySectionName($sectionName),
  35. ];
  36. }
  37. return $sectionsArray;
  38. }
  39. public function getSettingDetailsFlat(): array
  40. {
  41. $settingDetailsFlatArray = [];
  42. foreach($this->getSettingDetails() as $sectionsArray) {
  43. foreach($sectionsArray as $subsectionsArray) {
  44. foreach($subsectionsArray as $settingDetail) {
  45. $settingDetailsFlatArray[] = $settingDetail;
  46. }
  47. }
  48. }
  49. return $settingDetailsFlatArray;
  50. }
  51. public function getSectionLabelBySectionName(string $sectionName): string
  52. {
  53. return $this->getSectionLabels()[$sectionName];
  54. }
  55. }