SourceFactory.php 850 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Config\Model\Config;
  7. /**
  8. * @api
  9. * @since 100.0.2
  10. */
  11. class SourceFactory
  12. {
  13. /**
  14. * Object manager
  15. *
  16. * @var \Magento\Framework\ObjectManagerInterface
  17. */
  18. protected $_objectManager;
  19. /**
  20. * @param \Magento\Framework\ObjectManagerInterface $objectManager
  21. */
  22. public function __construct(\Magento\Framework\ObjectManagerInterface $objectManager)
  23. {
  24. $this->_objectManager = $objectManager;
  25. }
  26. /**
  27. * Create backend model by name
  28. *
  29. * @param string $modelName
  30. * @return \Magento\Framework\Option\ArrayInterface
  31. */
  32. public function create($modelName)
  33. {
  34. $model = $this->_objectManager->get($modelName);
  35. return $model;
  36. }
  37. }