custom/plugins/RoomViewer/src/RooomViewer.php line 9

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace RooomViewer;
  3. use Shopware\Core\Framework\Plugin;
  4. use Shopware\Core\Framework\Plugin\Context\InstallContext;
  5. use Shopware\Core\System\CustomField\CustomFieldTypes;
  6. class RooomViewer extends Plugin
  7. {
  8.     public function install(InstallContext $context): void
  9.     {
  10.         $customFieldRepository $this->container->get('custom_field_set.repository');
  11.         // saleschannel: einbettungslink
  12.         // product: id,
  13. //            mode
  14.         $customFieldRepository->create(
  15.             [
  16.                 [
  17.                     'name' => 'room_viewer',
  18.                     'config' => [
  19.                         'label' => [
  20.                             'en-GB' => 'Rooom Viewer',
  21.                             'de-DE' => 'Rooom Viewer',
  22.                         ]
  23.                     ],
  24.                     'customFields' => [
  25.                         [
  26.                             'name' => 'rooom_viewer_embed',
  27.                             'type' => CustomFieldTypes::TEXT,
  28.                             'config' => [
  29.                                 'componentName' => 'sw-field',
  30.                                 'customFieldType' => 'text',
  31.                                 'label' => [
  32.                                     'en-GB' => 'Embed',
  33.                                     'de-DE' => 'Embed',
  34.                                 ]
  35.                             ],
  36.                             'active' => true,
  37.                         ]
  38.                     ],
  39.                     'relations' => [
  40.                         ['entityName' => 'sales_channel']
  41.                     ]
  42.                 ]
  43.             ],
  44.             $context->getContext()
  45.         );
  46.         $customFieldRepository->create(
  47.             [
  48.                 [
  49.                     'name' => 'room_viewer',
  50.                     'config' => [
  51.                         'label' => [
  52.                             'en-GB' => 'Rooom Viewer',
  53.                             'de-DE' => 'Rooom Viewer',
  54.                         ]
  55.                     ],
  56.                     'customFields' => [
  57.                         [
  58.                             'name' => 'rooom_id',
  59.                             'type' => CustomFieldTypes::TEXT,
  60.                             'config' => [
  61.                                 'componentName' => 'sw-field',
  62.                                 'customFieldType' => 'text',
  63.                                 'label' => [
  64.                                     'en-GB' => 'Rooom Viewer ID',
  65.                                     'de-DE' => 'Rooom Viewer ID',
  66.                                 ]
  67.                             ],
  68.                             'active' => true,
  69.                         ],
  70.                         [
  71.                             'name' => 'rooom_mode',
  72.                             'type' => CustomFieldTypes::BOOL,
  73.                             'config' => [
  74.                                 'componentName' => 'sw-field',
  75.                                 'customFieldType' => 'switch',
  76.                                 'label' => [
  77.                                     'en-GB' => 'Replace Image',
  78.                                     'de-DE' => 'Bilder Ersetzen',
  79.                                 ]
  80.                             ],
  81.                             'active' => true,
  82.                         ]
  83.                     ],
  84.                     'relations' => [
  85.                         ['entityName' => 'product']
  86.                     ]
  87.                 ]
  88.             ],
  89.             $context->getContext()
  90.         );
  91.     }
  92. }