HalfPageCustomCosSection.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /**
  3. * Class HalfPageCustomCosSection
  4. * User: Nessandro
  5. * Date: 2019-10-07
  6. * Time: 15:22
  7. * @package ModulesGarden\Servers\KerioEmail\App\UI\Admin\Custom\Sections
  8. */
  9. namespace ModulesGarden\Servers\KerioEmail\App\UI\Admin\Custom\Sections;
  10. use ModulesGarden\Servers\KerioEmail\Core\UI\Widget\Forms\Sections\HalfPageSection;
  11. class HalfPageCustomCosSection extends HalfPageSection
  12. {
  13. public function loadDataToForm(&$dataProvider)
  14. {
  15. foreach($this->fields as &$field)
  16. {
  17. /**
  18. * update for cos fields
  19. */
  20. $cos = $dataProvider->getValueById('cos');
  21. $value = $cos[$field->getId()] ? $cos[$field->getId()] : $dataProvider->getValueById($field->getId());
  22. $field->setValue($value);
  23. $avValues = $dataProvider->getAvailableValuesById($field->getId());
  24. if ($avValues && method_exists($field, 'setAvailableValues'))
  25. {
  26. $field->setAvailableValues($avValues);
  27. }
  28. }
  29. foreach ($this->sections as &$section)
  30. {
  31. $section->loadDataToForm($dataProvider);
  32. }
  33. }
  34. }