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/extmag/shiplab/Block/Adminhtml/Label/View/Tab/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/vendor/extmag/shiplab/Block/Adminhtml/Label/View/Tab/Label.php
<?php
/**
 * Copyright © Extmag. All rights reserved.
 */

namespace Extmag\Shiplab\Block\Adminhtml\Label\View\Tab;

use Extmag\Shiplab\Block\Adminhtml\Label\View\Tab\Label\Data;
use Magento\Backend\Block\Template;
use Magento\Backend\Block\Widget\Tab\TabInterface;

class Label extends Template implements TabInterface
{
    /**
     * @var Label
     */
    protected $label;

    /**
     * @param Data $label
     * @param Template\Context $context
     * @param array $data
     */
    public function __construct(
        Data             $label,
        Template\Context $context,
        array            $data = []
    ) {
        parent::__construct($context, $data);
        $this->label = $label;
    }

    /**
     * {@inheritdoc}
     */
    public function getTabLabel()
    {
        return $this->getTabTitle();
    }

    /**
     * {@inheritdoc}
     */
    public function getTabTitle()
    {
        $childName = $this->getNameInLayout();
        switch ($childName) {
            case 'shiplab_label_edit_tab_label':
                return __('Shipping Labels');
            case 'shiplab_label_edit_tab_label_refund':
                return __('Rma Labels');
            case 'shiplab_label_edit_tab_label_inverse':
                return __('Inverse Labels');
        }

        return '';
    }

    /**
     * {@inheritdoc}
     */
    public function canShowTab()
    {
        $directionTypes = [];
        $labels = $this->label->getLabel();
        if (count($labels) > 0) {
            foreach ($labels as $label) {
                $directionTypes[$label->getTypeDirection()] = 1;
            }
        }

        $childName = $this->getNameInLayout();
        $isShow = false;
        switch ($childName) {
            case 'shiplab_label_edit_tab_label':
                if (isset($directionTypes['shipment'])) {
                    $isShow = true;
                }
                break;
            case 'shiplab_label_edit_tab_label_refund':
                if (isset($directionTypes['refund'])) {
                    $isShow = true;
                }
                break;
            case 'shiplab_label_edit_tab_label_inverse':
                if (isset($directionTypes['inverse'])) {
                    $isShow = true;
                }
                break;
        }

        if ($isShow) {
            return true;
        } else {
            return false;
        }
    }

    /**
     * {@inheritdoc}
     */
    public function isHidden()
    {
        return false;
    }

    /**
     * Tab class getter
     *
     * @return string
     */
    public function getTabClass()
    {
        return '';
    }

    /**
     * Return URL link to Tab content
     *
     * @return string
     */
    public function getTabUrl()
    {
        return '';
    }

    /**
     * Tab should be loaded trough Ajax call
     *
     * @return bool
     */
    public function isAjaxLoaded()
    {
        return false;
    }
}

Spamworldpro Mini