TwiceColumnSection.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. namespace ModulesGarden\Servers\ProxmoxCloudVps\App\UI\Admin\Product\Sections;
  3. use ModulesGarden\Servers\ProxmoxCloudVps\Core\UI\Widget\Forms\Sections\BoxSection;
  4. use ModulesGarden\Servers\ProxmoxCloudVps\Core\UI\Widget\Forms\Sections\HalfPageSection;
  5. class TwiceColumnSection extends BoxSection
  6. {
  7. /**
  8. * @var HalfPageSection
  9. */
  10. protected $leftSection;
  11. /**
  12. * @var HalfPageSection
  13. */
  14. protected $rightSection;
  15. public function initContent()
  16. {
  17. $this->leftSection = new HalfPageSection('leftSection');
  18. $this->rightSection = new HalfPageSection('rightSection');
  19. $this->addSection($this->leftSection)
  20. ->addSection($this->rightSection);
  21. $this->initFields();
  22. }
  23. protected function initFields()
  24. {
  25. }
  26. public function addField($field){
  27. $total = count($this->leftSection->getFields()) + count($this->rightSection->getFields());
  28. if($total % 2 == 0){
  29. $this->leftSection->addField($field);
  30. }else{
  31. $this->rightSection->addField($field);
  32. }
  33. return $this;
  34. }
  35. }