Vertical.php 843 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Analytics\Model\Config\Backend;
  7. use Magento\Framework\Exception\LocalizedException;
  8. /**
  9. * A backend model for verticals configuration.
  10. */
  11. class Vertical extends \Magento\Framework\App\Config\Value
  12. {
  13. /**
  14. * Handles the value of the selected vertical before saving.
  15. *
  16. * Note that the selected vertical should not be empty since
  17. * it will cause distortion of the analytics reports.
  18. *
  19. * @return $this
  20. * @throws LocalizedException if the value of the selected vertical is empty.
  21. */
  22. public function beforeSave()
  23. {
  24. if (empty($this->getValue())) {
  25. throw new LocalizedException(__('Please select an industry.'));
  26. }
  27. return $this;
  28. }
  29. }