Vertical.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Analytics\Model\Config\Source;
  7. /**
  8. * A source model for verticals configuration.
  9. *
  10. * Prepares and provides options for a selector of verticals which is located
  11. * in the corresponding configuration menu of the Admin area.
  12. */
  13. class Vertical implements \Magento\Framework\Option\ArrayInterface
  14. {
  15. /**
  16. * The list of possible verticals.
  17. *
  18. * This list is configured via di.xml and may be extended or changed
  19. * in any module if it is needed.
  20. *
  21. * It is supposed that the list may be changed in each Magento release.
  22. *
  23. * @var array
  24. */
  25. private $verticals;
  26. /**
  27. * @param array $verticals
  28. */
  29. public function __construct(array $verticals)
  30. {
  31. $this->verticals = $verticals;
  32. }
  33. /**
  34. * {@inheritdoc}
  35. */
  36. public function toOptionArray()
  37. {
  38. $result = [
  39. ['value' => '', 'label' => __('--Please Select--')]
  40. ];
  41. foreach ($this->verticals as $vertical) {
  42. $result[] = ['value' => $vertical, 'label' => __($vertical)];
  43. }
  44. return $result;
  45. }
  46. }