-
Notifications
You must be signed in to change notification settings - Fork 158
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
34 changed files
with
585 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/Renderer/ContentElement/ContentElementRendererInterface.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
/* | ||
* This file was created by developers working at BitBag | ||
* Do you need more information about us and what we do? Visit our https://bitbag.io website! | ||
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace BitBag\SyliusCmsPlugin\Renderer\ContentElement; | ||
|
||
use BitBag\SyliusCmsPlugin\Entity\ContentConfigurationInterface; | ||
|
||
interface ContentElementRendererInterface | ||
{ | ||
public function supports(ContentConfigurationInterface $contentConfiguration): bool; | ||
|
||
public function render(ContentConfigurationInterface $contentConfiguration): string; | ||
} |
40 changes: 40 additions & 0 deletions
40
src/Renderer/ContentElement/HeadingContentElementRenderer.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
/* | ||
* This file was created by developers working at BitBag | ||
* Do you need more information about us and what we do? Visit our https://bitbag.io website! | ||
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace BitBag\SyliusCmsPlugin\Renderer\ContentElement; | ||
|
||
use BitBag\SyliusCmsPlugin\Entity\ContentConfigurationInterface; | ||
use BitBag\SyliusCmsPlugin\Form\Type\ContentElements\HeadingContentElementType; | ||
use Twig\Environment; | ||
|
||
final class HeadingContentElementRenderer implements ContentElementRendererInterface | ||
{ | ||
public function __construct(private Environment $twig) | ||
{ | ||
} | ||
|
||
public function supports(ContentConfigurationInterface $contentConfiguration): bool | ||
{ | ||
return HeadingContentElementType::TYPE === $contentConfiguration->getType(); | ||
} | ||
|
||
public function render(ContentConfigurationInterface $contentConfiguration): string | ||
{ | ||
$configuration = $contentConfiguration->getConfiguration(); | ||
$headingType = $configuration['heading_type']; | ||
$headingContent = $configuration['heading']; | ||
|
||
return $this->twig->render('@BitBagSyliusCmsPlugin/Shop/ContentElement/index.html.twig', [ | ||
'content_element' => '@BitBagSyliusCmsPlugin/Shop/ContentElement/_heading.html.twig', | ||
'heading_type' => $headingType, | ||
'heading_content' => $headingContent, | ||
]); | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
src/Renderer/ContentElement/MultipleMediaContentElementRenderer.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
/* | ||
* This file was created by developers working at BitBag | ||
* Do you need more information about us and what we do? Visit our https://bitbag.io website! | ||
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace BitBag\SyliusCmsPlugin\Renderer\ContentElement; | ||
|
||
use BitBag\SyliusCmsPlugin\Entity\ContentConfigurationInterface; | ||
use BitBag\SyliusCmsPlugin\Form\Type\ContentElements\MultipleMediaContentElementType; | ||
use BitBag\SyliusCmsPlugin\Twig\Runtime\RenderMediaRuntimeInterface; | ||
use Twig\Environment; | ||
|
||
final class MultipleMediaContentElementRenderer implements ContentElementRendererInterface | ||
{ | ||
public function __construct( | ||
private Environment $twig, | ||
private RenderMediaRuntimeInterface $renderMediaRuntime, | ||
) { | ||
} | ||
|
||
public function supports(ContentConfigurationInterface $contentConfiguration): bool | ||
{ | ||
return MultipleMediaContentElementType::TYPE === $contentConfiguration->getType(); | ||
} | ||
|
||
public function render(ContentConfigurationInterface $contentConfiguration): string | ||
{ | ||
$media = []; | ||
$codes = $contentConfiguration->getConfiguration()['multiple_media']; | ||
foreach ($codes as $code) { | ||
$media[] = $this->renderMediaRuntime->renderMedia($code); | ||
} | ||
|
||
return $this->twig->render('@BitBagSyliusCmsPlugin/Shop/ContentElement/index.html.twig', [ | ||
'content_element' => '@BitBagSyliusCmsPlugin/Shop/ContentElement/_multiple_media.html.twig', | ||
'media' => $media, | ||
]); | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
src/Renderer/ContentElement/ProductsCarouselByTaxonContentElementRenderer.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
/* | ||
* This file was created by developers working at BitBag | ||
* Do you need more information about us and what we do? Visit our https://bitbag.io website! | ||
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace BitBag\SyliusCmsPlugin\Renderer\ContentElement; | ||
|
||
use BitBag\SyliusCmsPlugin\Entity\ContentConfigurationInterface; | ||
use BitBag\SyliusCmsPlugin\Form\Type\ContentElements\ProductsCarouselByTaxonContentElementType; | ||
use Sylius\Component\Core\Model\TaxonInterface; | ||
use Sylius\Component\Core\Repository\ProductRepositoryInterface; | ||
use Sylius\Component\Taxonomy\Repository\TaxonRepositoryInterface; | ||
use Twig\Environment; | ||
|
||
final class ProductsCarouselByTaxonContentElementRenderer implements ContentElementRendererInterface | ||
{ | ||
public function __construct( | ||
private Environment $twig, | ||
private ProductRepositoryInterface $productRepository, | ||
private TaxonRepositoryInterface $taxonRepository, | ||
) { | ||
} | ||
|
||
public function supports(ContentConfigurationInterface $contentConfiguration): bool | ||
{ | ||
return ProductsCarouselByTaxonContentElementType::TYPE === $contentConfiguration->getType(); | ||
} | ||
|
||
public function render(ContentConfigurationInterface $contentConfiguration): string | ||
{ | ||
$taxonCode = $contentConfiguration->getConfiguration()['products_carousel_by_taxon']; | ||
|
||
/** @var TaxonInterface $taxon */ | ||
$taxon = $this->taxonRepository->findOneBy(['code' => $taxonCode]); | ||
$products = $this->productRepository->findByTaxon($taxon); | ||
|
||
return $this->twig->render('@BitBagSyliusCmsPlugin/Shop/ContentElement/index.html.twig', [ | ||
'content_element' => '@BitBagSyliusCmsPlugin/Shop/ContentElement/_products_carousel.html.twig', | ||
'products' => $products, | ||
]); | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
src/Renderer/ContentElement/ProductsCarouselContentElementRenderer.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
/* | ||
* This file was created by developers working at BitBag | ||
* Do you need more information about us and what we do? Visit our https://bitbag.io website! | ||
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace BitBag\SyliusCmsPlugin\Renderer\ContentElement; | ||
|
||
use BitBag\SyliusCmsPlugin\Entity\ContentConfigurationInterface; | ||
use BitBag\SyliusCmsPlugin\Form\Type\ContentElements\ProductsCarouselContentElementType; | ||
use Sylius\Component\Core\Repository\ProductRepositoryInterface; | ||
use Twig\Environment; | ||
|
||
final class ProductsCarouselContentElementRenderer implements ContentElementRendererInterface | ||
{ | ||
public function __construct( | ||
private Environment $twig, | ||
private ProductRepositoryInterface $productRepository, | ||
) { | ||
} | ||
|
||
public function supports(ContentConfigurationInterface $contentConfiguration): bool | ||
{ | ||
return ProductsCarouselContentElementType::TYPE === $contentConfiguration->getType(); | ||
} | ||
|
||
public function render(ContentConfigurationInterface $contentConfiguration): string | ||
{ | ||
$configuration = $contentConfiguration->getConfiguration(); | ||
$productsCodes = $configuration['products_carousel']['products']; | ||
$products = $this->productRepository->findBy(['code' => $productsCodes]); | ||
|
||
return $this->twig->render('@BitBagSyliusCmsPlugin/Shop/ContentElement/index.html.twig', [ | ||
'content_element' => '@BitBagSyliusCmsPlugin/Shop/ContentElement/_products_carousel.html.twig', | ||
'products' => $products, | ||
]); | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
src/Renderer/ContentElement/SingleMediaContentElementRenderer.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
/* | ||
* This file was created by developers working at BitBag | ||
* Do you need more information about us and what we do? Visit our https://bitbag.io website! | ||
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace BitBag\SyliusCmsPlugin\Renderer\ContentElement; | ||
|
||
use BitBag\SyliusCmsPlugin\Entity\ContentConfigurationInterface; | ||
use BitBag\SyliusCmsPlugin\Form\Type\ContentElements\SingleMediaContentElementType; | ||
use BitBag\SyliusCmsPlugin\Twig\Runtime\RenderMediaRuntimeInterface; | ||
use Twig\Environment; | ||
|
||
final class SingleMediaContentElementRenderer implements ContentElementRendererInterface | ||
{ | ||
public function __construct( | ||
private Environment $twig, | ||
private RenderMediaRuntimeInterface $renderMediaRuntime, | ||
) { | ||
} | ||
|
||
public function supports(ContentConfigurationInterface $contentConfiguration): bool | ||
{ | ||
return SingleMediaContentElementType::TYPE === $contentConfiguration->getType(); | ||
} | ||
|
||
public function render(ContentConfigurationInterface $contentConfiguration): string | ||
{ | ||
$code = $contentConfiguration->getConfiguration()['single_media']; | ||
|
||
return $this->twig->render('@BitBagSyliusCmsPlugin/Shop/ContentElement/index.html.twig', [ | ||
'content_element' => '@BitBagSyliusCmsPlugin/Shop/ContentElement/_single_media.html.twig', | ||
'media' => $this->renderMediaRuntime->renderMedia($code), | ||
]); | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
src/Renderer/ContentElement/TaxonsListContentElementRenderer.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
/* | ||
* This file was created by developers working at BitBag | ||
* Do you need more information about us and what we do? Visit our https://bitbag.io website! | ||
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace BitBag\SyliusCmsPlugin\Renderer\ContentElement; | ||
|
||
use BitBag\SyliusCmsPlugin\Entity\ContentConfigurationInterface; | ||
use BitBag\SyliusCmsPlugin\Form\Type\ContentElements\TaxonsListContentElementType; | ||
use Sylius\Component\Taxonomy\Repository\TaxonRepositoryInterface; | ||
use Twig\Environment; | ||
|
||
final class TaxonsListContentElementRenderer implements ContentElementRendererInterface | ||
{ | ||
public function __construct( | ||
private Environment $twig, | ||
private TaxonRepositoryInterface $taxonRepository, | ||
) { | ||
} | ||
|
||
public function supports(ContentConfigurationInterface $contentConfiguration): bool | ||
{ | ||
return TaxonsListContentElementType::TYPE === $contentConfiguration->getType(); | ||
} | ||
|
||
public function render(ContentConfigurationInterface $contentConfiguration): string | ||
{ | ||
$configuration = $contentConfiguration->getConfiguration(); | ||
$taxonsCodes = $configuration['taxons_list']['taxons']; | ||
$taxons = $this->taxonRepository->findBy(['code' => $taxonsCodes]); | ||
|
||
return $this->twig->render('@BitBagSyliusCmsPlugin/Shop/ContentElement/index.html.twig', [ | ||
'content_element' => '@BitBagSyliusCmsPlugin/Shop/ContentElement/_taxons_list.html.twig', | ||
'taxons' => $taxons, | ||
]); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
src/Renderer/ContentElement/TextareaContentElementRenderer.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
/* | ||
* This file was created by developers working at BitBag | ||
* Do you need more information about us and what we do? Visit our https://bitbag.io website! | ||
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace BitBag\SyliusCmsPlugin\Renderer\ContentElement; | ||
|
||
use BitBag\SyliusCmsPlugin\Entity\ContentConfigurationInterface; | ||
use BitBag\SyliusCmsPlugin\Form\Type\ContentElements\TextareaContentElementType; | ||
use Twig\Environment; | ||
|
||
final class TextareaContentElementRenderer implements ContentElementRendererInterface | ||
{ | ||
public function __construct(private Environment $twig) | ||
{ | ||
} | ||
|
||
public function supports(ContentConfigurationInterface $contentConfiguration): bool | ||
{ | ||
return TextareaContentElementType::TYPE === $contentConfiguration->getType(); | ||
} | ||
|
||
public function render(ContentConfigurationInterface $contentConfiguration): string | ||
{ | ||
return $this->twig->render('@BitBagSyliusCmsPlugin/Shop/ContentElement/index.html.twig', [ | ||
'content_element' => '@BitBagSyliusCmsPlugin/Shop/ContentElement/_textarea.html.twig', | ||
'content' => $contentConfiguration->getConfiguration()['textarea'], | ||
]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
.carousel-wrapper { | ||
position: relative; | ||
|
||
.carousel { | ||
margin: 0 -1em; | ||
} | ||
|
||
.carousel-nav { | ||
.carousel-left { | ||
left: 30px; | ||
} | ||
|
||
.carousel-right { | ||
right: 30px; | ||
} | ||
|
||
.carousel-left, .carousel-right { | ||
position: absolute; | ||
top: 50%; | ||
transform: translateY(-50%); | ||
} | ||
} | ||
|
||
.carousel-item { | ||
padding: 5px 1em; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
@import './block/main.scss'; | ||
@import 'carousel'; |
Oops, something went wrong.