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/app/code/Soon/Faq/Block/Adminhtml/System/Config/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //home/corals/old/app/code/Soon/Faq/Block/Adminhtml/System/Config/StorePicker.php
<?php
/**
 * This file is part of Soon_Faq for Magento2.
 *
 * @license All rights reserved
 * @author Krzysztof Majkowski <[email protected]>
 * @category Soon
 * @package Soon_Faq
 * @copyright Copyright (c) 2017 Agence Soon (http://www.agence-soon.fr)
 */

namespace Soon\Faq\Block\Adminhtml\System\Config;

use Magento\Framework\View\Element\AbstractBlock;
use Magento\Framework\View\Element\Context;
use Magento\Store\Model\StoreManagerInterface;

/**
 * Class StorePicker
 * @package Soon\Faq\Block\Adminhtml\System\Config
 */
class StorePicker extends AbstractBlock
{
    /**
     * @var StoreManagerInterface
     */
    protected $storeManager;

    public function __construct(
        StoreManagerInterface $storeManager,
        Context $context,
        array $data = []
    )
    {
        parent::__construct($context, $data);
        $this->storeManager = $storeManager;
    }

    /**
     * Render field structure.
     *
     * @return string
     */
    protected function _toHtml()
    {
        $elId = $this->getData('input_id');
        $elName = $this->getData('input_name');
        $colName = $this->getData('column_name');
        $column = $this->getData('column');

        $html = '<select id="' . $elId . '"' .
            ' name="' . $elName . '" <%- ' . $colName . ' %> ' .
            ($column['size'] ? 'size="' . $column['size'] . '"' : '') .
            ' class="' .
            (isset($column['class']) ? $column['class'] : 'input-text') . '"' .
            (isset($column['style']) ? ' style="' . $column['style'] . '"' : '') . '>';

        foreach ($this->_getStores() as $id => $name) {
            $html .= '<option value="' . $id . '">' . $name . '</option>';
        }

        $html .= '</select>';

        return $html;
    }

    /**
     * Get stores
     *
     * @return array
     */
    protected function _getStores()
    {
        $stores = ['0' => __('All')];
        foreach ($this->storeManager->getStores() as $store) {
            $stores[$store->getId()] = $store->getName();
        }

        return $stores;
    }
}

Spamworldpro Mini