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/fooman/pdfcore-m2/src/Block/System/Config/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/vendor/fooman/pdfcore-m2/src/Block/System/Config/Columns.php
<?php
/**
 * @copyright Copyright (c) 2015 Fooman Limited (http://www.fooman.co.nz)
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Fooman\PdfCore\Block\System\Config;

class Columns extends \Magento\Framework\View\Element\Html\Select
{
    /**
     * @var \Fooman\PdfCore\Model\Config\Source\ProductAttributes
     */
    protected $productAttributeSource;

    protected $excludes = [];

    public function __construct(
        \Magento\Framework\View\Element\Context $context,
        \Fooman\PdfCore\Model\Config\Source\ProductAttributes $productAttributeSource,
        array $data = []
    ) {
        $this->productAttributeSource = $productAttributeSource;
        if (isset($data['excludes'])) {
            $this->excludes = $data['excludes'];
        }
        parent::__construct($context, $data);
    }

    /**
     * Render block HTML
     *
     * @return string
     */
    // phpcs:ignore PSR2.Methods.MethodDeclaration -- Magento 2 Core use
    public function _toHtml()
    {
        if (!$this->getOptions()) {
            $this->setOptions($this->getColumns());
        }
        return parent::_toHtml();
    }

    protected function getColumns()
    {
        return [
            ['label' => __('Item Attributes'), 'value' => $this->getItemColumns()],
            ['label' => __('Product Attributes'), 'value' => $this->getProductColumns()]
        ];
    }

    public function getItemColumns()
    {
        $allColumns = [
            ['value' => 'sku', 'label' => __('Sku')],
            ['value' => 'name', 'label' => __('Name')],
            ['value' => 'nameAndSku', 'label' => __('Name + SKU')],
            ['value' => 'nameWithLink', 'label' => __('Name with Link')],
            ['value' => 'position', 'label' => __('Position')],
            ['value' => 'price', 'label' => __('Price')],
            ['value' => 'priceInclExcl', 'label' => __('Price Excl./Incl. Tax')],
            ['value' => 'priceWithWeee', 'label' => __('Price with FPT')],
            ['value' => 'originalPrice', 'label' => __('Original Price')],
            ['value' => 'qty', 'label' => __('Qty')],
            ['value' => 'qtyOrdered', 'label' => __('Order Qty')],
            ['value' => 'qtyBackOrdered', 'label' => __('Back Ordered Qty')],
            ['value' => 'qtyToShip', 'label' => __('Qty To Ship')],
            ['value' => 'qtyDetails', 'label' => __('Qty Details')],
            ['value' => 'subtotal', 'label' => __('Subtotal')],
            ['value' => 'subtotalExcl', 'label' => __('Subtotal (Excl.)')],
            ['value' => 'subtotalWithWeee', 'label' => __('Subtotal with FPT')],
            ['value' => 'discount', 'label' => __('Discount')],
            ['value' => 'discountPercentage', 'label' => __('Discount Percentage')],
            ['value' => 'discountOriginalPercentage', 'label' => __('Discount Percentage (from Original)')],
            ['value' => 'rowtotal', 'label' => __('Row Total')],
            ['value' => 'tax', 'label' => __('Tax')],
            ['value' => 'productWeee', 'label' => __('Fixed Product Taxes')],
            ['value' => 'taxPercentage', 'label' => __('Tax Percentage')],
            ['value' => 'image', 'label' => __('Product Image')],
            ['value' => 'swatch', 'label' => __('Product Swatch')],
            ['value' => 'barcode', 'label' => __('Barcode')],
            ['value' => 'qrCode', 'label' => __('QR Code')],
            ['value' => 'weight', 'label' => __('Weight')],
            ['value' => 'rowWeight', 'label' => __('Row Weight')],
            ['value' => 'checkbox', 'label' => __('Checkbox')],
            ['value' => 'secondCheckbox', 'label' => __('2nd Checkbox')],
            ['value' => 'allocatedSources', 'label' => __('Allocated Sources')]
        ];
        if (!empty($this->excludes)) {
            foreach ($allColumns as $key => $column) {
                if (in_array($column['value'], $this->excludes)) {
                    unset($allColumns[$key]);
                }
            }
        }
        return $allColumns;
    }

    protected function getProductColumns()
    {
        return $this->productAttributeSource->toOptionArray();
    }

    public function setInputName($value)
    {
        return $this->setName($value);
    }
}

Spamworldpro Mini