diff --git a/src/Renderer/ContentElement/ProductsCarouselByTaxonContentElementRenderer.php b/src/Renderer/ContentElement/ProductsCarouselByTaxonContentElementRenderer.php index 59d8c573..b7c2869e 100644 --- a/src/Renderer/ContentElement/ProductsCarouselByTaxonContentElementRenderer.php +++ b/src/Renderer/ContentElement/ProductsCarouselByTaxonContentElementRenderer.php @@ -37,6 +37,10 @@ public function render(ContentConfigurationInterface $contentConfiguration): str /** @var TaxonInterface $taxon */ $taxon = $this->taxonRepository->findOneBy(['code' => $taxonCode]); + if (null === $taxon) { + return ''; + } + $products = $this->productRepository->findByTaxon($taxon); return $this->twig->render('@BitBagSyliusCmsPlugin/Shop/ContentElement/index.html.twig', [ diff --git a/src/Renderer/ContentElement/ProductsCarouselContentElementRenderer.php b/src/Renderer/ContentElement/ProductsCarouselContentElementRenderer.php index 83d014e5..180290e9 100644 --- a/src/Renderer/ContentElement/ProductsCarouselContentElementRenderer.php +++ b/src/Renderer/ContentElement/ProductsCarouselContentElementRenderer.php @@ -33,6 +33,9 @@ public function render(ContentConfigurationInterface $contentConfiguration): str $configuration = $contentConfiguration->getConfiguration(); $productsCodes = $configuration['products_carousel']['products']; $products = $this->productRepository->findBy(['code' => $productsCodes]); + if (empty($products)) { + return ''; + } return $this->twig->render('@BitBagSyliusCmsPlugin/Shop/ContentElement/index.html.twig', [ 'content_element' => '@BitBagSyliusCmsPlugin/Shop/ContentElement/_products_carousel.html.twig', diff --git a/src/Renderer/ContentElement/ProductsGridByTaxonContentElementRenderer.php b/src/Renderer/ContentElement/ProductsGridByTaxonContentElementRenderer.php index 3877ddda..e4d17510 100644 --- a/src/Renderer/ContentElement/ProductsGridByTaxonContentElementRenderer.php +++ b/src/Renderer/ContentElement/ProductsGridByTaxonContentElementRenderer.php @@ -37,6 +37,10 @@ public function render(ContentConfigurationInterface $contentConfiguration): str /** @var TaxonInterface $taxon */ $taxon = $this->taxonRepository->findOneBy(['code' => $taxonCode]); + if (null === $taxon) { + return ''; + } + $products = $this->productRepository->findByTaxon($taxon); return $this->twig->render('@BitBagSyliusCmsPlugin/Shop/ContentElement/index.html.twig', [ diff --git a/src/Renderer/ContentElement/SingleMediaContentElementRenderer.php b/src/Renderer/ContentElement/SingleMediaContentElementRenderer.php index 1b61dbdb..348b705e 100644 --- a/src/Renderer/ContentElement/SingleMediaContentElementRenderer.php +++ b/src/Renderer/ContentElement/SingleMediaContentElementRenderer.php @@ -33,6 +33,10 @@ public function supports(ContentConfigurationInterface $contentConfiguration): b public function render(ContentConfigurationInterface $contentConfiguration): string { $code = $contentConfiguration->getConfiguration()['single_media']; + if (null === $code) { + return ''; + } + $media = [ 'renderedContent' => $this->renderMediaRuntime->renderMedia($code), 'entity' => $this->mediaRepository->findOneBy(['code' => $code]), diff --git a/src/Resources/views/Page/Crud/_form.html.twig b/src/Resources/views/Page/Crud/_form.html.twig index 97fb6a55..5d74fe74 100755 --- a/src/Resources/views/Page/Crud/_form.html.twig +++ b/src/Resources/views/Page/Crud/_form.html.twig @@ -15,6 +15,10 @@ {{ form_row(form.channels) }} {{ form_row(form.collections) }} {{ form_row(form.publishAt) }} + + + {{ 'bitbag_sylius_cms_plugin.ui.preview'|trans }} +

{{ 'bitbag_sylius_cms_plugin.ui.seo'|trans }}