<?php declare(strict_types=1);
namespace MoorlCmsTestimonial;
use MoorlFoundation\Core\PluginFoundation;
use MoorlFoundation\Core\Service\DataService;
use Shopware\Core\Framework\Plugin;
use Shopware\Core\Framework\Plugin\Context\ActivateContext;
use Shopware\Core\Framework\Plugin\Context\UninstallContext;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
class MoorlCmsTestimonial extends Plugin
{
public const NAME = 'MoorlCmsTestimonial';
public const DATA_CREATED_AT = '2022-03-21 00:00:00.000';
public const PLUGIN_TABLES = [
'moorl_testimonial',
'moorl_testimonial_translation',
];
public const SHOPWARE_TABLES = [
'media_default_folder',
'moorl_sorting'
];
public function build(ContainerBuilder $container): void
{
parent::build($container);
$loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/Content/DependencyInjection'));
$loader->load('media.xml');
}
public function activate(ActivateContext $activateContext): void
{
parent::activate($activateContext);
/* @var $dataService DataService */
$dataService = $this->container->get(DataService::class);
$dataService->install(self::NAME);
}
public function uninstall(UninstallContext $context): void
{
parent::uninstall($context);
if ($context->keepUserData()) {
return;
}
/* @var $foundation PluginFoundation */
$foundation = $this->container->get(PluginFoundation::class);
$foundation->setContext($context->getContext());
$foundation->removeCmsSlots(['moorl-testimonial']);
$foundation->removeCmsBlocks(['moorl-testimonial-three-column']);
}
}