<?php declare(strict_types=1);
namespace TraumPlugin;
use Shopware\Core\Framework\Plugin;
use Shopware\Core\System\CustomField\CustomFieldTypes;
use Shopware\Core\Framework\Plugin\Context\InstallContext;
use Shopware\Core\Framework\Plugin\Context\UpdateContext;
//use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface;
class TraumPlugin extends Plugin
{
public const TRAUM_CF_PDF = 'pdf_file';
public const TRAUM_CF_PDF_NAME = 'pdf_file_name';
public const TRAUM_CFS = 'custom_traum_default';
public const TRAUM_CFS_ID = '8c3e7692ef10471c8d86df1e02d5dc61';
public const TRAUM_CF_PDF_LABEL = 'PDF';
public const TRAUM_CF_PDF_NAME_LABEL = 'PDF-Name';
public const CUSTOM_FIELDS = [
[
'name' => self::TRAUM_CFS,
'id' => self::TRAUM_CFS_ID,
'customFields' => [
[
'name' => self::TRAUM_CFS . '_show_sofa_hint' ,
'type' => CustomFieldTypes::BOOL,
'config' => [
'label' => [
'en-GB' => 'Hinweis zu Stoffen/Leder bei Sofas anzeigen',
'de-DE' => 'Hinweis zu Stoffen/Leder bei Sofas anzeigen',
],
'componentName' => "sw-field",
'customFieldType' => "switch",
'customFieldPosition' => 7
],
],
[
'name' => self::TRAUM_CFS . '_' . self::TRAUM_CF_PDF,
'type' => CustomFieldTypes::TEXT,
'config' => [
'label' => [
'en-GB' => self::TRAUM_CF_PDF_LABEL,
'de-DE' => self::TRAUM_CF_PDF_LABEL,
],
'componentName' => "sw-media-field",
'customFieldType' => "media",
'customFieldPosition' => 8
],
],
[
'name' => self::TRAUM_CFS . '_' . self::TRAUM_CF_PDF_NAME,
'type' => CustomFieldTypes::TEXT,
'config' => [
'label' => [
'en-GB' => self::TRAUM_CF_PDF_NAME_LABEL,
'de-DE' => self::TRAUM_CF_PDF_NAME_LABEL,
],
'componentName' => "sw-field",
'customFieldType' => "text",
'customFieldPosition' => 9
],
],
[
'name' => self::TRAUM_CFS . '_' . self::TRAUM_CF_PDF . '1',
'type' => CustomFieldTypes::TEXT,
'config' => [
'label' => [
'en-GB' => self::TRAUM_CF_PDF_LABEL . '1',
'de-DE' => self::TRAUM_CF_PDF_LABEL . '1',
],
'componentName' => "sw-media-field",
'customFieldType' => "media",
'customFieldPosition' => 10
],
],
[
'name' => self::TRAUM_CFS . '_' . self::TRAUM_CF_PDF_NAME . '1',
'type' => CustomFieldTypes::TEXT,
'config' => [
'label' => [
'en-GB' => self::TRAUM_CF_PDF_NAME_LABEL . '1',
'de-DE' => self::TRAUM_CF_PDF_NAME_LABEL . '1',
],
'componentName' => "sw-field",
'customFieldType' => "text",
'customFieldPosition' => 11
]
],
[
'name' => self::TRAUM_CFS . '_' . self::TRAUM_CF_PDF . '2',
'type' => CustomFieldTypes::TEXT,
'config' => [
'label' => [
'en-GB' => self::TRAUM_CF_PDF_LABEL . '2',
'de-DE' => self::TRAUM_CF_PDF_LABEL . '2',
],
'componentName' => "sw-media-field",
'customFieldType' => "media",
'customFieldPosition' => 12
],
],
[
'name' => self::TRAUM_CFS . '_' . self::TRAUM_CF_PDF_NAME . '2',
'type' => CustomFieldTypes::TEXT,
'config' => [
'label' => [
'en-GB' => self::TRAUM_CF_PDF_NAME_LABEL . '2',
'de-DE' => self::TRAUM_CF_PDF_NAME_LABEL . '2',
],
'componentName' => "sw-field",
'customFieldType' => "text",
'customFieldPosition' => 13
]
],
[
'name' => self::TRAUM_CFS . '_' . self::TRAUM_CF_PDF . '3',
'type' => CustomFieldTypes::TEXT,
'config' => [
'label' => [
'en-GB' => self::TRAUM_CF_PDF_LABEL . '3',
'de-DE' => self::TRAUM_CF_PDF_LABEL . '3',
],
'componentName' => "sw-media-field",
'customFieldType' => "media",
'customFieldPosition' => 14
],
],
[
'name' => self::TRAUM_CFS . '_' . self::TRAUM_CF_PDF_NAME . '3',
'type' => CustomFieldTypes::TEXT,
'config' => [
'label' => [
'en-GB' => self::TRAUM_CF_PDF_NAME_LABEL . '3',
'de-DE' => self::TRAUM_CF_PDF_NAME_LABEL . '3',
],
'componentName' => "sw-field",
'customFieldType' => "text",
'customFieldPosition' => 15
]
],
[
'name' => self::TRAUM_CFS . '_' . self::TRAUM_CF_PDF . '4',
'type' => CustomFieldTypes::TEXT,
'config' => [
'label' => [
'en-GB' => self::TRAUM_CF_PDF_LABEL . '4',
'de-DE' => self::TRAUM_CF_PDF_LABEL . '4',
],
'componentName' => "sw-media-field",
'customFieldType' => "media",
'customFieldPosition' => 16
],
],
[
'name' => self::TRAUM_CFS . '_' . self::TRAUM_CF_PDF_NAME . '4',
'type' => CustomFieldTypes::TEXT,
'config' => [
'label' => [
'en-GB' => self::TRAUM_CF_PDF_NAME_LABEL . '4',
'de-DE' => self::TRAUM_CF_PDF_NAME_LABEL . '4',
],
'componentName' => "sw-field",
'customFieldType' => "text",
'customFieldPosition' => 17
]
],
[
'name' => self::TRAUM_CFS . '_' . self::TRAUM_CF_PDF . '5',
'type' => CustomFieldTypes::TEXT,
'config' => [
'label' => [
'en-GB' => self::TRAUM_CF_PDF_LABEL . '5',
'de-DE' => self::TRAUM_CF_PDF_LABEL . '5',
],
'componentName' => "sw-media-field",
'customFieldType' => "media",
'customFieldPosition' => 18
],
],
[
'name' => self::TRAUM_CFS . '_' . self::TRAUM_CF_PDF_NAME . '5',
'type' => CustomFieldTypes::TEXT,
'config' => [
'label' => [
'en-GB' => self::TRAUM_CF_PDF_NAME_LABEL . '5',
'de-DE' => self::TRAUM_CF_PDF_NAME_LABEL . '5',
],
'componentName' => "sw-field",
'customFieldType' => "text",
'customFieldPosition' => 19
]
],
[
'name' => self::TRAUM_CFS . '_' . self::TRAUM_CF_PDF . '6',
'type' => CustomFieldTypes::TEXT,
'config' => [
'label' => [
'en-GB' => self::TRAUM_CF_PDF_LABEL . '6',
'de-DE' => self::TRAUM_CF_PDF_LABEL . '6',
],
'componentName' => "sw-media-field",
'customFieldType' => "media",
'customFieldPosition' => 20
],
],
[
'name' => self::TRAUM_CFS . '_' . self::TRAUM_CF_PDF_NAME . '6',
'type' => CustomFieldTypes::TEXT,
'config' => [
'label' => [
'en-GB' => self::TRAUM_CF_PDF_NAME_LABEL . '6',
'de-DE' => self::TRAUM_CF_PDF_NAME_LABEL . '6',
],
'componentName' => "sw-field",
'customFieldType' => "text",
'customFieldPosition' => 21
]
],
[
'name' => self::TRAUM_CFS . '_' . self::TRAUM_CF_PDF . '7',
'type' => CustomFieldTypes::TEXT,
'config' => [
'label' => [
'en-GB' => self::TRAUM_CF_PDF_LABEL . '7',
'de-DE' => self::TRAUM_CF_PDF_LABEL . '7',
],
'componentName' => "sw-media-field",
'customFieldType' => "media",
'customFieldPosition' => 22
],
],
[
'name' => self::TRAUM_CFS . '_' . self::TRAUM_CF_PDF_NAME . '7',
'type' => CustomFieldTypes::TEXT,
'config' => [
'label' => [
'en-GB' => self::TRAUM_CF_PDF_NAME_LABEL . '7',
'de-DE' => self::TRAUM_CF_PDF_NAME_LABEL . '7',
],
'componentName' => "sw-field",
'customFieldType' => "text",
'customFieldPosition' => 23
]
],
[
'name' => self::TRAUM_CFS . '_' . self::TRAUM_CF_PDF . '8',
'type' => CustomFieldTypes::TEXT,
'config' => [
'label' => [
'en-GB' => self::TRAUM_CF_PDF_LABEL . '8',
'de-DE' => self::TRAUM_CF_PDF_LABEL . '8',
],
'componentName' => "sw-media-field",
'customFieldType' => "media",
'customFieldPosition' => 24
],
],
[
'name' => self::TRAUM_CFS . '_' . self::TRAUM_CF_PDF_NAME . '8',
'type' => CustomFieldTypes::TEXT,
'config' => [
'label' => [
'en-GB' => self::TRAUM_CF_PDF_NAME_LABEL . '8',
'de-DE' => self::TRAUM_CF_PDF_NAME_LABEL . '8',
],
'componentName' => "sw-field",
'customFieldType' => "text",
'customFieldPosition' => 25
]
],
[
'name' => self::TRAUM_CFS . '_' . self::TRAUM_CF_PDF . '9',
'type' => CustomFieldTypes::TEXT,
'config' => [
'label' => [
'en-GB' => self::TRAUM_CF_PDF_LABEL . '9',
'de-DE' => self::TRAUM_CF_PDF_LABEL . '9',
],
'componentName' => "sw-media-field",
'customFieldType' => "media",
'customFieldPosition' => 26
],
],
[
'name' => self::TRAUM_CFS . '_' . self::TRAUM_CF_PDF_NAME . '9',
'type' => CustomFieldTypes::TEXT,
'config' => [
'label' => [
'en-GB' => self::TRAUM_CF_PDF_NAME_LABEL . '9',
'de-DE' => self::TRAUM_CF_PDF_NAME_LABEL . '9',
],
'componentName' => "sw-field",
'customFieldType' => "text",
'customFieldPosition' => 27
]
],
[
'name' => self::TRAUM_CFS . '_' . self::TRAUM_CF_PDF . '10',
'type' => CustomFieldTypes::TEXT,
'config' => [
'label' => [
'en-GB' => self::TRAUM_CF_PDF_LABEL . '10',
'de-DE' => self::TRAUM_CF_PDF_LABEL . '10',
],
'componentName' => "sw-media-field",
'customFieldType' => "media",
'customFieldPosition' => 28
],
],
[
'name' => self::TRAUM_CFS . '_' . self::TRAUM_CF_PDF_NAME . '10',
'type' => CustomFieldTypes::TEXT,
'config' => [
'label' => [
'en-GB' => self::TRAUM_CF_PDF_NAME_LABEL . '10',
'de-DE' => self::TRAUM_CF_PDF_NAME_LABEL . '10',
],
'componentName' => "sw-field",
'customFieldType' => "text",
'customFieldPosition' => 29
]
],
[
'name' => self::TRAUM_CFS . '_' . self::TRAUM_CF_PDF . '11',
'type' => CustomFieldTypes::TEXT,
'config' => [
'label' => [
'en-GB' => self::TRAUM_CF_PDF_LABEL . '11',
'de-DE' => self::TRAUM_CF_PDF_LABEL . '11',
],
'componentName' => "sw-media-field",
'customFieldType' => "media",
'customFieldPosition' => 30
],
],
[
'name' => self::TRAUM_CFS . '_' . self::TRAUM_CF_PDF_NAME . '11',
'type' => CustomFieldTypes::TEXT,
'config' => [
'label' => [
'en-GB' => self::TRAUM_CF_PDF_NAME_LABEL . '11',
'de-DE' => self::TRAUM_CF_PDF_NAME_LABEL . '11',
],
'componentName' => "sw-field",
'customFieldType' => "text",
'customFieldPosition' => 31
]
],
[
'name' => self::TRAUM_CFS . '_' . self::TRAUM_CF_PDF . '12',
'type' => CustomFieldTypes::TEXT,
'config' => [
'label' => [
'en-GB' => self::TRAUM_CF_PDF_LABEL . '12',
'de-DE' => self::TRAUM_CF_PDF_LABEL . '12',
],
'componentName' => "sw-media-field",
'customFieldType' => "media",
'customFieldPosition' => 32
],
],
[
'name' => self::TRAUM_CFS . '_' . self::TRAUM_CF_PDF_NAME . '12',
'type' => CustomFieldTypes::TEXT,
'config' => [
'label' => [
'en-GB' => self::TRAUM_CF_PDF_NAME_LABEL . '12',
'de-DE' => self::TRAUM_CF_PDF_NAME_LABEL . '12',
],
'componentName' => "sw-field",
'customFieldType' => "text",
'customFieldPosition' => 33
]
],
[
'name' => self::TRAUM_CFS . '_' . self::TRAUM_CF_PDF . '13',
'type' => CustomFieldTypes::TEXT,
'config' => [
'label' => [
'en-GB' => self::TRAUM_CF_PDF_LABEL . '13',
'de-DE' => self::TRAUM_CF_PDF_LABEL . '13',
],
'componentName' => "sw-media-field",
'customFieldType' => "media",
'customFieldPosition' => 34
],
],
[
'name' => self::TRAUM_CFS . '_' . self::TRAUM_CF_PDF_NAME . '13',
'type' => CustomFieldTypes::TEXT,
'config' => [
'label' => [
'en-GB' => self::TRAUM_CF_PDF_NAME_LABEL . '13',
'de-DE' => self::TRAUM_CF_PDF_NAME_LABEL . '13',
],
'componentName' => "sw-field",
'customFieldType' => "text",
'customFieldPosition' => 35
]
],
[
'name' => self::TRAUM_CFS . '_' . self::TRAUM_CF_PDF . '14',
'type' => CustomFieldTypes::TEXT,
'config' => [
'label' => [
'en-GB' => self::TRAUM_CF_PDF_LABEL . '14',
'de-DE' => self::TRAUM_CF_PDF_LABEL . '14',
],
'componentName' => "sw-media-field",
'customFieldType' => "media",
'customFieldPosition' => 36
],
],
[
'name' => self::TRAUM_CFS . '_' . self::TRAUM_CF_PDF_NAME . '14',
'type' => CustomFieldTypes::TEXT,
'config' => [
'label' => [
'en-GB' => self::TRAUM_CF_PDF_NAME_LABEL . '14',
'de-DE' => self::TRAUM_CF_PDF_NAME_LABEL . '14',
],
'componentName' => "sw-field",
'customFieldType' => "text",
'customFieldPosition' => 37
]
],
[
'name' => self::TRAUM_CFS . '_' . self::TRAUM_CF_PDF . '15',
'type' => CustomFieldTypes::TEXT,
'config' => [
'label' => [
'en-GB' => self::TRAUM_CF_PDF_LABEL . '15',
'de-DE' => self::TRAUM_CF_PDF_LABEL . '15',
],
'componentName' => "sw-media-field",
'customFieldType' => "media",
'customFieldPosition' => 38
],
],
[
'name' => self::TRAUM_CFS . '_' . self::TRAUM_CF_PDF_NAME . '15',
'type' => CustomFieldTypes::TEXT,
'config' => [
'label' => [
'en-GB' => self::TRAUM_CF_PDF_NAME_LABEL . '15',
'de-DE' => self::TRAUM_CF_PDF_NAME_LABEL . '15',
],
'componentName' => "sw-field",
'customFieldType' => "text",
'customFieldPosition' => 39
]
],
[
'name' => self::TRAUM_CFS . '_' . self::TRAUM_CF_PDF . '16',
'type' => CustomFieldTypes::TEXT,
'config' => [
'label' => [
'en-GB' => self::TRAUM_CF_PDF_LABEL . '16',
'de-DE' => self::TRAUM_CF_PDF_LABEL . '16',
],
'componentName' => "sw-media-field",
'customFieldType' => "media",
'customFieldPosition' => 40
],
],
[
'name' => self::TRAUM_CFS . '_' . self::TRAUM_CF_PDF_NAME . '16',
'type' => CustomFieldTypes::TEXT,
'config' => [
'label' => [
'en-GB' => self::TRAUM_CF_PDF_NAME_LABEL . '16',
'de-DE' => self::TRAUM_CF_PDF_NAME_LABEL . '16',
],
'componentName' => "sw-field",
'customFieldType' => "text",
'customFieldPosition' => 41
]
],
[
'name' => self::TRAUM_CFS . '_' . self::TRAUM_CF_PDF . '17',
'type' => CustomFieldTypes::TEXT,
'config' => [
'label' => [
'en-GB' => self::TRAUM_CF_PDF_LABEL . '17',
'de-DE' => self::TRAUM_CF_PDF_LABEL . '17',
],
'componentName' => "sw-media-field",
'customFieldType' => "media",
'customFieldPosition' => 42
],
],
[
'name' => self::TRAUM_CFS . '_' . self::TRAUM_CF_PDF_NAME . '17',
'type' => CustomFieldTypes::TEXT,
'config' => [
'label' => [
'en-GB' => self::TRAUM_CF_PDF_NAME_LABEL . '17',
'de-DE' => self::TRAUM_CF_PDF_NAME_LABEL . '17',
],
'componentName' => "sw-field",
'customFieldType' => "text",
'customFieldPosition' => 43
]
],
[
'name' => self::TRAUM_CFS . '_' . self::TRAUM_CF_PDF . '18',
'type' => CustomFieldTypes::TEXT,
'config' => [
'label' => [
'en-GB' => self::TRAUM_CF_PDF_LABEL . '18',
'de-DE' => self::TRAUM_CF_PDF_LABEL . '18',
],
'componentName' => "sw-media-field",
'customFieldType' => "media",
'customFieldPosition' => 44
],
],
[
'name' => self::TRAUM_CFS . '_' . self::TRAUM_CF_PDF_NAME . '18',
'type' => CustomFieldTypes::TEXT,
'config' => [
'label' => [
'en-GB' => self::TRAUM_CF_PDF_NAME_LABEL . '18',
'de-DE' => self::TRAUM_CF_PDF_NAME_LABEL . '18',
],
'componentName' => "sw-field",
'customFieldType' => "text",
'customFieldPosition' => 45
]
],
[
'name' => self::TRAUM_CFS . '_' . self::TRAUM_CF_PDF . '19',
'type' => CustomFieldTypes::TEXT,
'config' => [
'label' => [
'en-GB' => self::TRAUM_CF_PDF_LABEL . '19',
'de-DE' => self::TRAUM_CF_PDF_LABEL . '19',
],
'componentName' => "sw-media-field",
'customFieldType' => "media",
'customFieldPosition' => 46
],
],
[
'name' => self::TRAUM_CFS . '_' . self::TRAUM_CF_PDF_NAME . '19',
'type' => CustomFieldTypes::TEXT,
'config' => [
'label' => [
'en-GB' => self::TRAUM_CF_PDF_NAME_LABEL . '19',
'de-DE' => self::TRAUM_CF_PDF_NAME_LABEL . '19',
],
'componentName' => "sw-field",
'customFieldType' => "text",
'customFieldPosition' => 47
]
],
]
]
];
public function install (InstallContext $installContext): void
{
// $customFieldSetRepository = $this->container->get('custom_field_set.repository');
// $customFieldSetRepository->upsert(self::CUSTOM_FIELDS, $installContext->getContext());
}
public function update(UpdateContext $updateContext): void
{
// $customFieldSetRepository = $this->container->get('custom_field_set.repository');
// $customFieldSetRepository->upsert(self::CUSTOM_FIELDS, $updateContext->getContext());
}
}