![]() 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/cartforge.co/vendor/magento/module-customer/Model/Customer/Attribute/Source/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Customer\Model\Customer\Attribute\Source; use Magento\Customer\Api\GroupManagementInterface; /** * Customer group attribute source * * @author Magento Core Team <[email protected]> */ class Group extends \Magento\Eav\Model\Entity\Attribute\Source\Table implements GroupSourceLoggedInOnlyInterface { /** * @var GroupManagementInterface */ protected $_groupManagement; /** * @var \Magento\Framework\Convert\DataObject */ protected $_converter; /** * @param \Magento\Eav\Model\ResourceModel\Entity\Attribute\Option\CollectionFactory $attrOptionCollectionFactory * @param \Magento\Eav\Model\ResourceModel\Entity\Attribute\OptionFactory $attrOptionFactory * @param GroupManagementInterface $groupManagement * @param \Magento\Framework\Convert\DataObject $converter */ public function __construct( \Magento\Eav\Model\ResourceModel\Entity\Attribute\Option\CollectionFactory $attrOptionCollectionFactory, \Magento\Eav\Model\ResourceModel\Entity\Attribute\OptionFactory $attrOptionFactory, GroupManagementInterface $groupManagement, \Magento\Framework\Convert\DataObject $converter ) { $this->_groupManagement = $groupManagement; $this->_converter = $converter; parent::__construct($attrOptionCollectionFactory, $attrOptionFactory); } /** * @inheritdoc */ public function getAllOptions($withEmpty = true, $defaultValues = false) { if (!$this->_options) { $groups = $this->_groupManagement->getLoggedInGroups(); $this->_options = $this->_converter->toOptionArray($groups, 'id', 'code'); } return $this->_options; } }