Theme.php 968 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. /**
  7. * Source model for eav attribute custom_design
  8. */
  9. namespace Magento\Theme\Model\Theme\Source;
  10. use Magento\Eav\Model\Entity\Attribute\Source\AbstractSource;
  11. use Magento\Framework\View\Design\Theme\Label;
  12. /**
  13. * Design
  14. *
  15. */
  16. class Theme extends AbstractSource
  17. {
  18. /**
  19. * @var Label
  20. */
  21. protected $themeLabel;
  22. /**
  23. * @param Label $themeLabel
  24. */
  25. public function __construct(Label $themeLabel)
  26. {
  27. $this->themeLabel = $themeLabel;
  28. }
  29. /**
  30. * Retrieve All Design Theme Options
  31. *
  32. * @param bool $withEmpty add empty (please select) values to result
  33. * @return Label[]
  34. */
  35. public function getAllOptions($withEmpty = true)
  36. {
  37. $label = $withEmpty ? __('-- Please Select --') : $withEmpty;
  38. return $this->_options = $this->themeLabel->getLabelsCollection($label);
  39. }
  40. }