AsyncSending.php 1003 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Sales\Model\Config\Backend\Email;
  7. /**
  8. * Backend model for global configuration value
  9. * 'sales_email/general/async_sending'.
  10. */
  11. class AsyncSending extends \Magento\Framework\App\Config\Value
  12. {
  13. /**
  14. * Dispatches corresponding event after saving of configuration
  15. * value if it was changed.
  16. *
  17. * Dispatches next events:
  18. *
  19. * - config_data_sales_email_general_async_sending_enabled
  20. * - config_data_sales_email_general_async_sending_disabled
  21. *
  22. * @return $this
  23. */
  24. public function afterSave()
  25. {
  26. if ($this->isValueChanged()) {
  27. $state = $this->getValue() ? 'enabled' : 'disabled';
  28. $this->_eventManager->dispatch(
  29. $this->_eventPrefix . '_sales_email_general_async_sending_' . $state,
  30. $this->_getEventData()
  31. );
  32. }
  33. return $this;
  34. }
  35. }