Skip to content

Commit

Permalink
OP-462: Page preview functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
jkindly committed Aug 2, 2024
1 parent 684dc18 commit 48242b0
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ public function render(ContentConfigurationInterface $contentConfiguration): str

/** @var TaxonInterface $taxon */
$taxon = $this->taxonRepository->findOneBy(['code' => $taxonCode]);
if (null === $taxon) {

Check failure on line 40 in src/Renderer/ContentElement/ProductsCarouselByTaxonContentElementRenderer.php

View workflow job for this annotation

GitHub Actions / Sylius ~1.13.0, PHP 8.1, Symfony ^6.4

Strict comparison using === between null and Sylius\Component\Core\Model\TaxonInterface will always evaluate to false.

Check failure on line 40 in src/Renderer/ContentElement/ProductsCarouselByTaxonContentElementRenderer.php

View workflow job for this annotation

GitHub Actions / Sylius ~1.13.0, PHP 8.1, Symfony ^5.4

Strict comparison using === between null and Sylius\Component\Core\Model\TaxonInterface will always evaluate to false.
return '';
}

$products = $this->productRepository->findByTaxon($taxon);

return $this->twig->render('@BitBagSyliusCmsPlugin/Shop/ContentElement/index.html.twig', [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ public function render(ContentConfigurationInterface $contentConfiguration): str

/** @var TaxonInterface $taxon */
$taxon = $this->taxonRepository->findOneBy(['code' => $taxonCode]);
if (null === $taxon) {

Check failure on line 40 in src/Renderer/ContentElement/ProductsGridByTaxonContentElementRenderer.php

View workflow job for this annotation

GitHub Actions / Sylius ~1.13.0, PHP 8.1, Symfony ^6.4

Strict comparison using === between null and Sylius\Component\Core\Model\TaxonInterface will always evaluate to false.

Check failure on line 40 in src/Renderer/ContentElement/ProductsGridByTaxonContentElementRenderer.php

View workflow job for this annotation

GitHub Actions / Sylius ~1.13.0, PHP 8.1, Symfony ^5.4

Strict comparison using === between null and Sylius\Component\Core\Model\TaxonInterface will always evaluate to false.
return '';
}

$products = $this->productRepository->findByTaxon($taxon);

return $this->twig->render('@BitBagSyliusCmsPlugin/Shop/ContentElement/index.html.twig', [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]),
Expand Down
4 changes: 4 additions & 0 deletions src/Resources/views/Page/Crud/_form.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
{{ form_row(form.channels) }}
{{ form_row(form.collections) }}
{{ form_row(form.publishAt) }}
<a href="#" data-bb-cms-preview-btn class="ui labeled button icon primary bitbag-cms-resource-preview" data-url="{{ path('bitbag_sylius_cms_plugin_admin_page_preview', {'id': form.vars.data.id}) }}">
<i class="eye icon"></i>
{{ 'bitbag_sylius_cms_plugin.ui.preview'|trans }}
</a>
</div>
<div class="ui segment">
<h4 class="ui dividing header">{{ 'bitbag_sylius_cms_plugin.ui.seo'|trans }}</h4>
Expand Down

0 comments on commit 48242b0

Please sign in to comment.