Attributes.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace Dotdigitalgroup\Email\Model\Config\Configuration;
  3. class Attributes implements \Magento\Framework\Data\OptionSourceInterface
  4. {
  5. /**
  6. * @var \Dotdigitalgroup\Email\Helper\Data
  7. */
  8. private $dataHelper;
  9. /**
  10. * Attributes constructor.
  11. *
  12. * @param \Dotdigitalgroup\Email\Helper\Data $dataHelper
  13. */
  14. public function __construct(
  15. \Dotdigitalgroup\Email\Helper\Data $dataHelper
  16. ) {
  17. $this->dataHelper = $dataHelper;
  18. }
  19. /**
  20. * Returns custom order attributes.
  21. *
  22. * @return array
  23. */
  24. public function toOptionArray()
  25. {
  26. $fields = $this->dataHelper->getOrderTableDescription();
  27. $customFields[] = [
  28. 'label' => __('---- Default Option ----'),
  29. 'value' => '0',
  30. ];
  31. foreach ($fields as $field) {
  32. $customFields[] = [
  33. 'value' => $field['COLUMN_NAME'],
  34. 'label' => $field['COLUMN_NAME'],
  35. ];
  36. }
  37. return $customFields;
  38. }
  39. }