![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/magento/module-bundle/Model/Product/Attribute/Source/Price/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Bundle\Model\Product\Attribute\Source\Price; use Magento\Eav\Model\ResourceModel\Entity\Attribute\OptionFactory; use Magento\Framework\DB\Ddl\Table; /** * Bundle Price View Attribute Renderer * * @api * @since 100.0.2 */ class View extends \Magento\Eav\Model\Entity\Attribute\Source\AbstractSource { /** * @var OptionFactory */ protected $optionFactory; /** * @param OptionFactory $optionFactory */ public function __construct(OptionFactory $optionFactory) { $this->optionFactory = $optionFactory; } /** * Get all options * * @return array */ public function getAllOptions() { if (null === $this->_options) { $this->_options = [ ['label' => __('Price Range'), 'value' => 0], ['label' => __('As Low as'), 'value' => 1], ]; } return $this->_options; } /** * Get a text for option value * * @param string|integer $value * @return string|bool */ public function getOptionText($value) { foreach ($this->getAllOptions() as $option) { if ($option['value'] == $value) { return $option['label']; } } return false; } /** * Retrieve flat column definition * * @return array */ public function getFlatColumns() { $attributeCode = $this->getAttribute()->getAttributeCode(); return [ $attributeCode => [ 'unsigned' => false, 'default' => null, 'extra' => null, 'type' => Table::TYPE_INTEGER, 'nullable' => true, 'comment' => 'Bundle Price View ' . $attributeCode . ' column', ], ]; } /** * Retrieve Select for update Attribute value in flat table * * @param int $store * @return \Magento\Framework\DB\Select|null */ public function getFlatUpdateSelect($store) { return $this->optionFactory->create()->getFlatUpdateSelect($this->getAttribute(), $store, false); } }