ShipmentIdentity.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Sales\Model\Order\Email\Container;
  7. class ShipmentIdentity extends Container implements IdentityInterface
  8. {
  9. /**
  10. * Configuration paths
  11. */
  12. const XML_PATH_EMAIL_COPY_METHOD = 'sales_email/shipment/copy_method';
  13. const XML_PATH_EMAIL_COPY_TO = 'sales_email/shipment/copy_to';
  14. const XML_PATH_EMAIL_IDENTITY = 'sales_email/shipment/identity';
  15. const XML_PATH_EMAIL_GUEST_TEMPLATE = 'sales_email/shipment/guest_template';
  16. const XML_PATH_EMAIL_TEMPLATE = 'sales_email/shipment/template';
  17. const XML_PATH_EMAIL_ENABLED = 'sales_email/shipment/enabled';
  18. /**
  19. * Is email enabled
  20. *
  21. * @return bool
  22. */
  23. public function isEnabled()
  24. {
  25. return $this->scopeConfig->isSetFlag(
  26. self::XML_PATH_EMAIL_ENABLED,
  27. \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
  28. $this->getStore()->getStoreId()
  29. );
  30. }
  31. /**
  32. * Return list of copy_to emails
  33. *
  34. * @return array|bool
  35. */
  36. public function getEmailCopyTo()
  37. {
  38. $data = $this->getConfigValue(self::XML_PATH_EMAIL_COPY_TO, $this->getStore()->getStoreId());
  39. if (!empty($data)) {
  40. return explode(',', $data);
  41. }
  42. return false;
  43. }
  44. /**
  45. * Return email copy method
  46. *
  47. * @return mixed
  48. */
  49. public function getCopyMethod()
  50. {
  51. return $this->getConfigValue(self::XML_PATH_EMAIL_COPY_METHOD, $this->getStore()->getStoreId());
  52. }
  53. /**
  54. * Return guest template id
  55. *
  56. * @return mixed
  57. */
  58. public function getGuestTemplateId()
  59. {
  60. return $this->getConfigValue(self::XML_PATH_EMAIL_GUEST_TEMPLATE, $this->getStore()->getStoreId());
  61. }
  62. /**
  63. * Return template id
  64. *
  65. * @return mixed
  66. */
  67. public function getTemplateId()
  68. {
  69. return $this->getConfigValue(self::XML_PATH_EMAIL_TEMPLATE, $this->getStore()->getStoreId());
  70. }
  71. /**
  72. * Return email identity
  73. *
  74. * @return mixed
  75. */
  76. public function getEmailIdentity()
  77. {
  78. return $this->getConfigValue(self::XML_PATH_EMAIL_IDENTITY, $this->getStore()->getStoreId());
  79. }
  80. }