Adapter.php 912 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Config\Model\Config\Source\Image;
  7. /**
  8. * @api
  9. * @since 100.0.2
  10. */
  11. class Adapter implements \Magento\Framework\Option\ArrayInterface
  12. {
  13. /**
  14. * @var \Magento\Framework\Image\Adapter\ConfigInterface
  15. */
  16. protected $config;
  17. /**
  18. * @param \Magento\Framework\Image\Adapter\ConfigInterface $config
  19. */
  20. public function __construct(\Magento\Framework\Image\Adapter\ConfigInterface $config)
  21. {
  22. $this->config = $config;
  23. }
  24. /**
  25. * Return hash of image adapter codes and labels
  26. *
  27. * @return array
  28. */
  29. public function toOptionArray()
  30. {
  31. $result = [];
  32. foreach ($this->config->getAdapters() as $alias => $adapter) {
  33. $result[$alias] = __($adapter['title']);
  34. }
  35. return $result;
  36. }
  37. }