custom/plugins/OttSaleCategory/src/OttSaleCategory.php line 10

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Ott\SaleCategory;
  3. use Ott\Base\Bootstrap\CustomFieldService;
  4. use Shopware\Core\Framework\Plugin;
  5. use Shopware\Core\Framework\Plugin\Context\InstallContext;
  6. use Shopware\Core\System\CustomField\CustomFieldTypes;
  7. class OttSaleCategory extends Plugin
  8. {
  9.     public function install(InstallContext $context): void
  10.     {
  11.         $customFieldService $this->container->get(CustomFieldService::class);
  12.         $customFieldService->addFieldSet(
  13.             'category_general',
  14.             [
  15.                 'de-DE' => 'Kategorie Allgemein',
  16.                 'en-GB' => 'Category general',
  17.             ],
  18.             [
  19.                 [
  20.                     'entityName' => 'category',
  21.                 ],
  22.             ],
  23.         );
  24.         $customFieldService->addField('category_general', [
  25.             'name'   => 'sale_active',
  26.             'type'   => CustomFieldTypes::BOOL,
  27.             'config' => [
  28.                 'label' => [
  29.                     'de-DE' => 'Sale aktiv',
  30.                     'en-GB' => 'Sale active',
  31.                 ],
  32.             ],
  33.         ]);
  34.         $customFieldService->addField('category_general', [
  35.             'name'   => 'highlight_red',
  36.             'type'   => CustomFieldTypes::BOOL,
  37.             'config' => [
  38.                 'label' => [
  39.                     'de-DE' => 'Rot hervorheben',
  40.                     'en-GB' => 'Emphasize in red',
  41.                 ],
  42.             ],
  43.         ]);
  44.         $customFieldService->update($context);
  45.     }
  46. }