<?php declare(strict_types=1);
namespace ChespackTwoTheme;
use ChespackTwoTheme\Util\Lifecycle\Install;
use ChespackTwoTheme\Util\Lifecycle\Update;
use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface;
use Shopware\Core\Framework\Plugin;
use Shopware\Core\Framework\Plugin\Context\ActivateContext;
use Shopware\Core\Framework\Plugin\Context\DeactivateContext;
use Shopware\Core\Framework\Plugin\Context\InstallContext;
use Shopware\Core\Framework\Plugin\Context\UninstallContext;
use Shopware\Core\Framework\Plugin\Context\UpdateContext;
use Shopware\Storefront\Framework\ThemeInterface;
class ChespackTwoTheme extends Plugin implements ThemeInterface
{
// Define custom field sets names
public const THEME_CUSTOM_FIELD_SET_CATEGORY_CTA_1 = 'custom_category_cta_1';
public const THEME_CUSTOM_FIELD_SET_CATEGORY_CTA_2 = 'custom_category_cta_2';
// Define custom fields names
// Category CTA custom fields
// 1st CTA-teaser
public const THEME_CUSTOM_FIELD_CATEGORY_CTA_ACTIVE_1 = 'chespack_category_cta_active_1';
public const THEME_CUSTOM_FIELD_CATEGORY_CTA_TITLE_1 = 'chespack_category_cta_title_1';
public const THEME_CUSTOM_FIELD_CATEGORY_CTA_TEXT_1 = 'chespack_category_cta_text_1';
public const THEME_CUSTOM_FIELD_CATEGORY_CTA_LINK_1 = 'chespack_category_cta_link_1';
public const THEME_CUSTOM_FIELD_CATEGORY_CTA_LINK_NEW_WINDOW_1 = 'chespack_category_cta_link_new_window_1';
public const THEME_CUSTOM_FIELD_CATEGORY_CTA_IMAGE_1 = 'chespack_category_cta_image_1';
// 2nd CTA-teaser
public const THEME_CUSTOM_FIELD_CATEGORY_CTA_ACTIVE_2 = 'chespack_category_cta_active_2';
public const THEME_CUSTOM_FIELD_CATEGORY_CTA_TITLE_2 = 'chespack_category_cta_title_2';
public const THEME_CUSTOM_FIELD_CATEGORY_CTA_TEXT_2 = 'chespack_category_cta_text_2';
public const THEME_CUSTOM_FIELD_CATEGORY_CTA_LINK_2 = 'chespack_category_cta_link_2';
public const THEME_CUSTOM_FIELD_CATEGORY_CTA_LINK_NEW_WINDOW_2 = 'chespack_category_cta_link_new_window_2';
public const THEME_CUSTOM_FIELD_CATEGORY_CTA_IMAGE_2 = 'chespack_category_cta_image_2';
/**
* Theme configuration
* @return string
*/
public function getThemeConfigPath(): string
{
return 'theme.json';
}
/**
* @param InstallContext $context
*/
public function install(InstallContext $context): void
{
}
/**
* @param UninstallContext $context
*/
public function uninstall(UninstallContext $context): void
{
}
/**
* @param ActivateContext $context
*/
public function activate(ActivateContext $context): void
{
}
/**
* @param DeactivateContext $context
*/
public function deactivate(DeactivateContext $context): void
{
}
/**
* @param UpdateContext $updateContext
*/
public function update(UpdateContext $updateContext): void
{
/** @var EntityRepositoryInterface $customFieldSetRepository */
$customFieldSetRepository = $this->container->get('custom_field_set.repository');
/** @var EntityRepositoryInterface $customFieldRepository */
$customFieldRepository = $this->container->get('custom_field.repository');
(new Update($customFieldSetRepository, $customFieldRepository))->update($updateContext);
parent::update($updateContext);
}
}