EditGeneralSection.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. namespace ThurData\Servers\KerioEmail\App\UI\Client\EmailAccount\Sections;
  3. use ThurData\Servers\KerioEmail\App\Traits\FormExtendedTrait;
  4. use ThurData\Servers\KerioEmail\App\UI\Admin\Custom\Sections\FreeFieldsSection;
  5. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Fields\Hidden;
  6. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Fields\Select;
  7. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Fields\Text;
  8. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Sections\InputGroup;
  9. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Fields\InputGroupElements;
  10. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Validators\Decimal;
  11. /**
  12. *
  13. * Created by PhpStorm.
  14. * User: ThurData
  15. * Date: 12.11.19
  16. * Time: 13:52
  17. * Class EditGeneralSection
  18. */
  19. class EditGeneralSection extends FreeFieldsSection
  20. {
  21. protected $id = 'editGeneralSection';
  22. protected $name = 'editGeneralSection';
  23. use FormExtendedTrait;
  24. public function initContent()
  25. {
  26. /**
  27. * add fields
  28. */
  29. $field = new Hidden('id');
  30. $this->addField($field);
  31. $this->generateDoubleSection([new Text('firstname'), new Text('lastname')]);
  32. $email =new InputGroup('usernameGroup');
  33. $email->addInputComponent((new InputGroupElements\Text('username'))->addHtmlAttribute('readonly','true'));
  34. $email->addInputAddon('emailSign', false, '@');
  35. $email->addInputComponent((new InputGroupElements\Text('domain'))->addHtmlAttribute('readonly','true'));
  36. $this->addSection($email);
  37. $this->generateDoubleSection([new Text('display_name'), new Select('status')]);
  38. $quota = new Text('quota');
  39. $quota->setDescription('description');
  40. $quota->addValidator(new Decimal(0));
  41. $this->generateDoubleSection([$quota, new Select('unit')]);
  42. }
  43. }