vendor/store.shopware.com/moorlcmstestimonial/src/MoorlCmsTestimonial.php line 14

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace MoorlCmsTestimonial;
  3. use MoorlFoundation\Core\PluginFoundation;
  4. use MoorlFoundation\Core\Service\DataService;
  5. use Shopware\Core\Framework\Plugin;
  6. use Shopware\Core\Framework\Plugin\Context\ActivateContext;
  7. use Shopware\Core\Framework\Plugin\Context\UninstallContext;
  8. use Symfony\Component\Config\FileLocator;
  9. use Symfony\Component\DependencyInjection\ContainerBuilder;
  10. use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
  11. class MoorlCmsTestimonial extends Plugin
  12. {
  13.     public const NAME 'MoorlCmsTestimonial';
  14.     public const DATA_CREATED_AT '2022-03-21 00:00:00.000';
  15.     public const PLUGIN_TABLES = [
  16.         'moorl_testimonial',
  17.         'moorl_testimonial_translation',
  18.     ];
  19.     public const SHOPWARE_TABLES = [
  20.         'cms_page',
  21.         'cms_page_translation',
  22.         'cms_section',
  23.         'cms_block',
  24.         'cms_slot',
  25.         'category',
  26.         'moorl_sorting'
  27.     ];
  28.     public function build(ContainerBuilder $container): void
  29.     {
  30.         parent::build($container);
  31.         $loader = new XmlFileLoader($container, new FileLocator(__DIR__ '/Content/DependencyInjection'));
  32.         $loader->load('media.xml');
  33.     }
  34.     public function activate(ActivateContext $activateContext): void
  35.     {
  36.         parent::activate($activateContext);
  37.         /* @var $dataService DataService */
  38.         $dataService $this->container->get(DataService::class);
  39.         $dataService->install(self::NAME);
  40.     }
  41.     public function uninstall(UninstallContext $context): void
  42.     {
  43.         parent::uninstall($context);
  44.         if ($context->keepUserData()) {
  45.             return;
  46.         }
  47.         /* @var $foundation PluginFoundation */
  48.         $foundation $this->container->get(PluginFoundation::class);
  49.         $foundation->setContext($context->getContext());
  50.         $foundation->removeCmsSlots(['moorl-testimonial']);
  51.         $foundation->removeCmsBlocks(['moorl-testimonial-three-column']);
  52.     }
  53. }