custom/plugins/ChespackTheme/src/ChespackTheme.php line 15

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace ChespackTheme;
  3. use ChespackTheme\Util\Lifecycle\Update;
  4. use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface;
  5. use Shopware\Core\Framework\Plugin;
  6. use Shopware\Core\Framework\Plugin\Context\ActivateContext;
  7. use Shopware\Core\Framework\Plugin\Context\DeactivateContext;
  8. use Shopware\Core\Framework\Plugin\Context\InstallContext;
  9. use Shopware\Core\Framework\Plugin\Context\UninstallContext;
  10. use Shopware\Core\Framework\Plugin\Context\UpdateContext;
  11. use Shopware\Storefront\Framework\ThemeInterface;
  12. class ChespackTheme extends Plugin implements ThemeInterface
  13. {
  14.     // Define custom field sets names
  15.     public const THEME_CUSTOM_FIELD_SET_CATEGORY 'custom_category_settings';
  16.     // Define custom fields names
  17.     // Category custom fields
  18.     public const THEME_CUSTOM_FIELD_CATEGORY_IMAGE_MENU 'chespack_category_image_menu';
  19.     // Agent custom fields
  20.     public const THEME_CUSTOM_FIELD_AGENT_PHONE 'chespack_agent_phone';
  21.     public const THEME_CUSTOM_FIELD_AGENT_IMAGE 'chespack_agent_image';
  22.     /**
  23.      * Theme configuration
  24.      * @return string
  25.      */
  26.     public function getThemeConfigPath(): string
  27.     {
  28.         return 'theme.json';
  29.     }
  30.     /**
  31.      * @param InstallContext $context
  32.      */
  33.     public function install(InstallContext $context): void
  34.     {
  35.     }
  36.     /**
  37.      * @param UninstallContext $context
  38.      */
  39.     public function uninstall(UninstallContext $context): void
  40.     {
  41.     }
  42.     /**
  43.      * @param ActivateContext $context
  44.      */
  45.     public function activate(ActivateContext $context): void
  46.     {
  47.     }
  48.     /**
  49.      * @param DeactivateContext $context
  50.      */
  51.     public function deactivate(DeactivateContext $context): void
  52.     {
  53.     }
  54.     /**
  55.      * @param UpdateContext $updateContext
  56.      */
  57.     public function update(UpdateContext $updateContext): void
  58.     {
  59.         /** @var EntityRepositoryInterface $customFieldSetRepository */
  60.         $customFieldSetRepository $this->container->get('custom_field_set.repository');
  61.         /** @var EntityRepositoryInterface $customFieldRepository */
  62.         $customFieldRepository $this->container->get('custom_field.repository');
  63.         /** @var EntityRepositoryInterface $agentRepository */
  64.         $agentRepository $this->container->get('vio_representative_agent.repository');
  65.         (new Update($customFieldSetRepository$customFieldRepository$agentRepository))->update($updateContext);
  66.         parent::update($updateContext);
  67.     }
  68. }