PageLayout.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Cms\Model\Page\Source;
  7. use Magento\Framework\Data\OptionSourceInterface;
  8. use Magento\Framework\View\Model\PageLayout\Config\BuilderInterface;
  9. /**
  10. * Class PageLayout
  11. */
  12. class PageLayout implements OptionSourceInterface
  13. {
  14. /**
  15. * @var \Magento\Framework\View\Model\PageLayout\Config\BuilderInterface
  16. */
  17. protected $pageLayoutBuilder;
  18. /**
  19. * @var array
  20. * @deprecated 103.0.1 since the cache is now handled by \Magento\Theme\Model\PageLayout\Config\Builder::$configFiles
  21. */
  22. protected $options;
  23. /**
  24. * Constructor
  25. *
  26. * @param BuilderInterface $pageLayoutBuilder
  27. */
  28. public function __construct(BuilderInterface $pageLayoutBuilder)
  29. {
  30. $this->pageLayoutBuilder = $pageLayoutBuilder;
  31. }
  32. /**
  33. * @inheritdoc
  34. */
  35. public function toOptionArray()
  36. {
  37. $configOptions = $this->pageLayoutBuilder->getPageLayoutsConfig()->getOptions();
  38. $options = [];
  39. foreach ($configOptions as $key => $value) {
  40. $options[] = [
  41. 'label' => $value,
  42. 'value' => $key,
  43. ];
  44. }
  45. $this->options = $options;
  46. return $options;
  47. }
  48. }