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.

170 lines
3.2KB

  1. <?php
  2. namespace domain\Setting\SettingDetails;
  3. class AbstractSettingDetail
  4. {
  5. public string $name;
  6. public string $label;
  7. public string $type;
  8. public string $section;
  9. public ?string $formType = null;
  10. public array $options = [];
  11. public $defaultValue = null;
  12. public ?string $subSection = null;
  13. public ?string $helpMessage = null;
  14. public function setName(string $name): self
  15. {
  16. $this->name = $name;
  17. return $this;
  18. }
  19. public function getName(): string
  20. {
  21. return $this->name;
  22. }
  23. public function setLabel(string $label): self
  24. {
  25. $this->label = $label;
  26. return $this;
  27. }
  28. public function getLabel(): string
  29. {
  30. return $this->label;
  31. }
  32. public function setSection(string $section): self
  33. {
  34. $this->section = $section;
  35. return $this;
  36. }
  37. public function getSection(): string
  38. {
  39. return $this->section;
  40. }
  41. public function setSubSection(string $subSection): self
  42. {
  43. $this->subSection = $subSection;
  44. return $this;
  45. }
  46. public function getSubSection(): ?string
  47. {
  48. return $this->subSection;
  49. }
  50. public function setHelpMessage(string $helpMessage): self
  51. {
  52. $this->helpMessage = $helpMessage;
  53. return $this;
  54. }
  55. public function getHelpMessage(): ?string
  56. {
  57. return $this->helpMessage;
  58. }
  59. public function getFormType(): ?string
  60. {
  61. return $this->formType;
  62. }
  63. public function setFormTypeInput(): self
  64. {
  65. $this->formType = 'input';
  66. return $this;
  67. }
  68. public function setFormTypeTextarea(): self
  69. {
  70. $this->formType = 'textarea';
  71. return $this;
  72. }
  73. public function setFormTypeCheckbox(): self
  74. {
  75. $this->formType = 'checkbox';
  76. return $this;
  77. }
  78. public function setFormTypeToggle(): self
  79. {
  80. $this->formType = 'toggle';
  81. return $this;
  82. }
  83. public function setFormTypeSelect(array $options): self
  84. {
  85. $this->formType = 'select';
  86. $this->options = $options;
  87. return $this;
  88. }
  89. public function getOptions(): array
  90. {
  91. return $this->options;
  92. }
  93. public function setDefaultValue($defaultValue): self
  94. {
  95. $this->defaultValue = $defaultValue;
  96. return $this;
  97. }
  98. public function getDefaultValue()
  99. {
  100. return $this->defaultValue;
  101. }
  102. public function setTypeString(): self
  103. {
  104. $this->type = 'string';
  105. return $this;
  106. }
  107. public function setTypeText(): self
  108. {
  109. $this->type = 'text';
  110. return $this;
  111. }
  112. public function setTypeBoolean(): self
  113. {
  114. $this->type = 'boolean';
  115. return $this;
  116. }
  117. public function setTypeDate(): self
  118. {
  119. $this->type = 'date';
  120. return $this;
  121. }
  122. public function setTypeInteger(): self
  123. {
  124. $this->type = 'integer';
  125. return $this;
  126. }
  127. public function setTypeFloat(): self
  128. {
  129. $this->type = 'float';
  130. return $this;
  131. }
  132. public function setTypeDouble(): self
  133. {
  134. $this->type = 'double';
  135. return $this;
  136. }
  137. public function getType(): string
  138. {
  139. return $this->type;
  140. }
  141. }