Categorylabel.php 957 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace Smartwave\Megamenu\Model\Attribute;
  3. class Categorylabel extends \Magento\Eav\Model\Entity\Attribute\Source\AbstractSource
  4. {
  5. protected $_helper;
  6. public function __construct(
  7. \Smartwave\Megamenu\Helper\Data $helper
  8. ) {
  9. $this->_helper = $helper;
  10. }
  11. public function getAllOptions()
  12. {
  13. $label1 = $this->_helper->getConfig('sw_megamenu/cat_labels/label1');
  14. $label2 = $this->_helper->getConfig('sw_megamenu/cat_labels/label2');
  15. $label3 = $this->_helper->getConfig('sw_megamenu/cat_labels/label3');
  16. if (!$this->_options) {
  17. $this->_options = [
  18. ['value' => '', 'label' => __('No Label')],
  19. ['value' => 'label1', 'label' => $label1],
  20. ['value' => 'label2', 'label' => $label2],
  21. ['value' => 'label3', 'label' => $label3]
  22. ];
  23. }
  24. return $this->_options;
  25. }
  26. }