php 修复设置:升级EasyTabs的“区域未设置”错误(vendor / swissup / module-easytabs / Setup /)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php 修复设置:升级EasyTabs的“区域未设置”错误(vendor / swissup / module-easytabs / Setup /)相关的知识,希望对你有一定的参考价值。

<?php
namespace Swissup\Easytabs\Setup;

use Magento\Framework\Setup\InstallDataInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Swissup\Easytabs\Model\EntityFactory as TabFactory;

/**
 * @codeCoverageIgnore
 */
class InstallData implements InstallDataInterface
{
    /**
     * Tab factory
     *
     * @var TabFactory
     */
    private $tabFactory;

    /**
     * Init
     *
     * @param TabFactory $tabFactory
     */
    public function __construct(TabFactory $tabFactory, \Magento\Framework\App\State $state)
    {
        $state->setAreaCode('frontend');
        $this->tabFactory = $tabFactory;
    }

    /**
     * {@inheritdoc}
     * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
     */
    public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
    {
        $tabs = [
            [
                'title' => 'Details',
                'alias' => 'product.info.description',
                'block' => 'Magento\Catalog\Block\Product\View\Description',
                'sort_order' => 0,
                'status' => 1,
                'widget_template' => 'Magento_Catalog::product/view/description.phtml',
                'stores' => [0]
            ],
            [
                'title' => 'More Information',
                'alias' => 'additional',
                'block' => 'Magento\Catalog\Block\Product\View\Attributes',
                'sort_order' => 10,
                'status' => 1,
                'widget_template' => 'Magento_Catalog::product/view/attributes.phtml',
                'stores' => [0]
            ],
            [
                'title' => '{{eval code="getTabTitle()"}}',
                'alias' => 'reviews',
                'block' => 'Swissup\Easytabs\Block\Tab\Product\Review',
                'sort_order' => 20,
                'status' => 1,
                'widget_template' => 'Magento_Review::review.phtml',
                'stores' => [0]
            ]
        ];
        /**
         * Insert default tabs
         */
        foreach ($tabs as $data) {
            $this->tabFactory->create()->setData($data)->save();
        }

    }
}

以上是关于php 修复设置:升级EasyTabs的“区域未设置”错误(vendor / swissup / module-easytabs / Setup /)的主要内容,如果未能解决你的问题,请参考以下文章

升级 PHP 版本后如何修复 Twig 文件中的 Html 标签问题

xml 将EasyTabs放在SoldTogether下的产品页面上

html [js-easytabs]制表符ui #js

如何修复与时区相关的 PHP 错误(function.strtotime 和 function.date)

将我的 ubuntu 服务器升级到 10.04 后如何修复我的虚拟主机设置

关于PHP漏洞修复