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/Ecombricks/Ui/Component/Model/Listing/Columns/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/Ecombricks/Ui/Component/Model/Listing/Columns/Actions.php
<?php
/**
 * Copyright © eComBricks. All rights reserved.
 * See LICENSE.txt for license details.
 */
namespace Ecombricks\Ui\Component\Model\Listing\Columns;

/**
 * Model listing actions column
 */
class Actions extends \Magento\Ui\Component\Listing\Columns\Column
{
    
    /**
     * Model config
     * 
     * @var \Ecombricks\Framework\Model\ConfigInterface
     */
    protected $modelConfig;
    
    /**
     * Constructor
     *
     * @param \Magento\Framework\View\Element\UiComponent\ContextInterface $context
     * @param \Magento\Framework\View\Element\UiComponentFactory $uiComponentFactory
     * @param \Ecombricks\Framework\Model\ConfigInterface $modelConfig
     * @param array $components
     * @param array $data
     * @return void
     */
    public function __construct(
        \Magento\Framework\View\Element\UiComponent\ContextInterface $context,
        \Magento\Framework\View\Element\UiComponentFactory $uiComponentFactory,
        \Ecombricks\Framework\Model\ConfigInterface $modelConfig,
        array $components = [],
        array $data = []
    )
    {
        $this->modelConfig = $modelConfig;
        parent::__construct(
            $context,
            $uiComponentFactory,
            $components,
            $data
        );
    }

    /**
     * Prepare data source
     *
     * @param array $dataSource
     * @return array
     */
    public function prepareDataSource(array $dataSource)
    {
        if (!isset($dataSource['data']['items'])) {
            return $dataSource;
        }
        foreach ($dataSource['data']['items'] as &$item) {
            if (!isset($item[$this->modelConfig->getIndexField()])) {
                continue;
            }
            $modelId = $item[$this->modelConfig->getIndexField()];
            $itemName = $this->getData('name');
            $item[$itemName] = [
                'edit' => [
                    'href' => $this->modelConfig->getEditUrl($modelId),
                    'label' => __('Edit')
                ]
            ];
            $item[$itemName]['delete'] = [
                'href' => $this->modelConfig->getDeleteUrl($modelId),
                'label' => __('Delete'),
                'confirm' => [
                    'title' => __('Delete "${ $.$data.'.$this->modelConfig->getNameField().' }"'),
                    'message' => __('Are you sure you wan\'t to delete a "${ $.$data.'.$this->modelConfig->getNameField().' }" %1?', $this->modelConfig->getLabel()->render())
                ]
            ];
        }
        return $dataSource;
    }
    
}

Spamworldpro Mini