In admin Catalog->Category->content
I would like this Form detail:Page Builder to have Layout->Row and Element->HTML Code=”Default Value” at setup.
<?php
namespace JustinsMyappSetupPatchData;
use MagentoEavModelEntityAttributeScopedAttributeInterface;
use MagentoEavSetupEavSetup;
use MagentoEavSetupEavSetupFactory;
use MagentoFrameworkSetupModuleDataSetupInterface;
use MagentoFrameworkSetupPatchDataPatchInterface;
use PsrLogLoggerInterface;
use MagentoCatalogModelCategory;
class AddFeatureDescription implements DataPatchInterface
{
const ATTRIBUTE_CODE = 'show_form_detail';
private $moduleDataSetup;
private $eavSetupFactory;
private $logger;
public function __construct(
ModuleDataSetupInterface $moduleDataSetup,
EavSetupFactory $eavSetupFactory,
LoggerInterface $logger
) {
$this->moduleDataSetup = $moduleDataSetup;
$this->eavSetupFactory = $eavSetupFactory;
$this->logger = $logger;
}
public static function getDependencies(): array
{
return [];
}
public function getAliases(): array
{
return [];
}
public function apply()
{
try {
$eavSetup = $this->eavSetupFactory->create(['setup' => $this->moduleDataSetup]);
$eavSetup->addAttribute(Category::ENTITY, self::ATTRIBUTE_CODE, [
'type' => 'text',
'label' => 'Description',
'input' => 'textarea',
'required' => false,
'sort_order' => 4,
'global' => ScopedAttributeInterface::SCOPE_STORE,
'wysiwyg_enabled' => true,
'is_html_allowed_on_front' => true,
'group' => 'General Information',
]);
} catch (Exception $e) {
$this->logger->error($e->getMessage());
}
}
}