Spamworldpro Mini Shell
Spamworldpro


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/aheadworks/module-csblock/Ui/Component/Listing/Columns/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/vendor/aheadworks/module-csblock/Ui/Component/Listing/Columns/Group.php
<?php
namespace Aheadworks\Csblock\Ui\Component\Listing\Columns;

use Magento\Framework\View\Element\UiComponentFactory;
use Magento\Framework\View\Element\UiComponent\ContextInterface;

/**
 * Class \Aheadworks\Csblock\Ui\Component\Listing\Columns\Group
 */
class Group extends \Magento\Ui\Component\Listing\Columns\Column
{
    protected $_customerGroupFactory;

    public function __construct(
        ContextInterface $context,
        UiComponentFactory $uiComponentFactory,
        \Magento\Customer\Model\GroupFactory $groupFactory,
        array $components = [],
        array $data = []
    ) {
        $this->_customerGroupFactory = $groupFactory;
        parent::__construct($context, $uiComponentFactory, $components, $data);
    }

    public function prepareDataSource(array $dataSource)
    {
        foreach ($dataSource['data']['items'] as &$item) {
            $item['customer_groups'] = $this->_prepareContent($item['customer_groups']);
        }

        return $dataSource;
    }

    protected function _prepareContent($customerGroup)
    {
        $content = [];
        $customerGroup = explode(',', (string)$customerGroup);
        if (!is_array($customerGroup)) {
            $customerGroup = [$customerGroup];
        }
        foreach ($customerGroup as $groupId) {
            $groupModel = $this->_customerGroupFactory->create();
            $groupModel->load($groupId);
            if (null === $groupModel->getId()) {
                continue;
            }
            $content[] = $groupModel->getCode();
        }

        return implode(', ', $content);
    }
}

Spamworldpro Mini