AbstractSwatch.php 687 B

12345678910111213141516171819202122232425
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Swatches\Model\Form\Element;
  7. class AbstractSwatch extends \Magento\Framework\Data\Form\Element\Select
  8. {
  9. /**
  10. * Get swatch values
  11. *
  12. * @return array
  13. * @throws \Magento\Framework\Exception\LocalizedException
  14. */
  15. protected function getValues()
  16. {
  17. $options = [];
  18. $attribute = $this->getData('entity_attribute');
  19. if ($attribute instanceof \Magento\Catalog\Model\ResourceModel\Eav\Attribute) {
  20. $options = $attribute->getSource()->getAllOptions(true, true);
  21. }
  22. return $options;
  23. }
  24. }