<?php declare(strict_types=1);
namespace Ott\MerchantShops;
use Ott\Base\Bootstrap\CustomFieldService;
use Shopware\Core\Framework\Plugin;
use Shopware\Core\Framework\Plugin\Context\InstallContext;
use Shopware\Core\System\CustomField\CustomFieldTypes;
class OttMerchantShops extends Plugin
{
public function install(InstallContext $installContext): void
{
$this->createCustomFields($installContext);
}
private function createCustomFields(InstallContext $installContext): void
{
$customFieldService = $this->container->get(CustomFieldService::class);
$customFieldService->addFieldSet(
'merchant_shops',
[
'de-DE' => 'Händlershops',
'en-GB' => 'Merchant shops',
],
[
[
'entityName' => 'category',
],
]
);
$customFieldService->addField('merchant_shops', [
'name' => 'merchant_id',
'type' => CustomFieldTypes::SELECT,
'config' => [
'entity' => 'ott_merchant',
'customFieldType' => 'entity',
'componentName' => 'sw-entity-single-select',
'label' => [
'de-DE' => 'Händler',
'en-GB' => 'Merchant',
],
],
]);
$customFieldService->update($installContext);
}
}