IsActive.php 959 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. /**
  9. * Class IsActive
  10. */
  11. class IsActive implements OptionSourceInterface
  12. {
  13. /**
  14. * @var \Magento\Cms\Model\Page
  15. */
  16. protected $cmsPage;
  17. /**
  18. * Constructor
  19. *
  20. * @param \Magento\Cms\Model\Page $cmsPage
  21. */
  22. public function __construct(\Magento\Cms\Model\Page $cmsPage)
  23. {
  24. $this->cmsPage = $cmsPage;
  25. }
  26. /**
  27. * Get options
  28. *
  29. * @return array
  30. */
  31. public function toOptionArray()
  32. {
  33. $availableOptions = $this->cmsPage->getAvailableStatuses();
  34. $options = [];
  35. foreach ($availableOptions as $key => $value) {
  36. $options[] = [
  37. 'label' => $value,
  38. 'value' => $key,
  39. ];
  40. }
  41. return $options;
  42. }
  43. }