![]() 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/mageworx/module-seoredirects/Setup/Patch/Data/ |
<?php /** * Copyright © MageWorx. All rights reserved. * See LICENSE.txt for license details. */ namespace MageWorx\SeoRedirects\Setup\Patch\Data; use Magento\Catalog\Model\Category; use Magento\Catalog\Setup\CategorySetupFactory; use Magento\Framework\Setup\ModuleDataSetupInterface; use Magento\Framework\Setup\Patch\DataPatchInterface; use Magento\Framework\Setup\Patch\PatchVersionInterface; use MageWorx\SeoAll\Helper\LinkFieldResolver; class AddAttributes implements DataPatchInterface, PatchVersionInterface { const REDIRECT_PRIORITY_CODE = 'redirect_priority'; /** * @var CategorySetupFactory */ protected $categorySetupFactory; /** * @var ModuleDataSetupInterface */ private $moduleDataSetup; public function __construct( ModuleDataSetupInterface $moduleDataSetup, CategorySetupFactory $categorySetupFactory ) { $this->moduleDataSetup = $moduleDataSetup; $this->categorySetupFactory = $categorySetupFactory; } /** * {@inheritdoc} */ public function apply() { $catalogSetup = $this->categorySetupFactory->create(['setup' => $this->moduleDataSetup]); $catalogSetup->addAttribute( Category::ENTITY, self::REDIRECT_PRIORITY_CODE, [ 'group' => 'Search Engine Optimization', 'type' => 'text', 'backend' => '', 'frontend' => '', 'label' => 'Product Redirect Priority', 'input' => 'text', 'class' => '', 'source' => '', 'global' => \Magento\Catalog\Model\ResourceModel\Eav\Attribute::SCOPE_STORE, 'visible' => true, 'required' => false, 'user_defined' => false, 'default' => 0, 'apply_to' => '', 'visible_on_front' => false, 'sort_order' => 9, 'frontend_class' => 'validate-percents', 'note' => '100 is the highest priority.' ] ); } /** * {@inheritdoc} */ public static function getDependencies() { return []; } /** * {@inheritdoc} */ public function getAliases() { return []; } public static function getVersion() { return '1.0.0'; } }