<?php declare(strict_types=1);
namespace RooomViewer;
use Shopware\Core\Framework\Plugin;
use Shopware\Core\Framework\Plugin\Context\InstallContext;
use Shopware\Core\System\CustomField\CustomFieldTypes;
class RooomViewer extends Plugin
{
public function install(InstallContext $context): void
{
$customFieldRepository = $this->container->get('custom_field_set.repository');
// saleschannel: einbettungslink
// product: id,
// mode
$customFieldRepository->create(
[
[
'name' => 'room_viewer',
'config' => [
'label' => [
'en-GB' => 'Rooom Viewer',
'de-DE' => 'Rooom Viewer',
]
],
'customFields' => [
[
'name' => 'rooom_viewer_embed',
'type' => CustomFieldTypes::TEXT,
'config' => [
'componentName' => 'sw-field',
'customFieldType' => 'text',
'label' => [
'en-GB' => 'Embed',
'de-DE' => 'Embed',
]
],
'active' => true,
]
],
'relations' => [
['entityName' => 'sales_channel']
]
]
],
$context->getContext()
);
$customFieldRepository->create(
[
[
'name' => 'room_viewer',
'config' => [
'label' => [
'en-GB' => 'Rooom Viewer',
'de-DE' => 'Rooom Viewer',
]
],
'customFields' => [
[
'name' => 'rooom_id',
'type' => CustomFieldTypes::TEXT,
'config' => [
'componentName' => 'sw-field',
'customFieldType' => 'text',
'label' => [
'en-GB' => 'Rooom Viewer ID',
'de-DE' => 'Rooom Viewer ID',
]
],
'active' => true,
],
[
'name' => 'rooom_mode',
'type' => CustomFieldTypes::BOOL,
'config' => [
'componentName' => 'sw-field',
'customFieldType' => 'switch',
'label' => [
'en-GB' => 'Replace Image',
'de-DE' => 'Bilder Ersetzen',
]
],
'active' => true,
]
],
'relations' => [
['entityName' => 'product']
]
]
],
$context->getContext()
);
}
}