-
Notifications
You must be signed in to change notification settings - Fork 2
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
1 parent
94aa3b3
commit e4635d5
Showing
9 changed files
with
146 additions
and
54 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of Monsieur Biz's SyliusUiElementsPlugin for Sylius. | ||
* (c) Monsieur Biz <[email protected]> | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace MonsieurBiz\SyliusUiElementsPlugin\Form\Type\UiElement; | ||
|
||
use MonsieurBiz\SyliusRichEditorPlugin\Attribute\AsUiElement; | ||
use MonsieurBiz\SyliusRichEditorPlugin\Attribute\TemplatesUiElement; | ||
use MonsieurBiz\SyliusRichEditorPlugin\Form\Type\WysiwygType; | ||
use MonsieurBiz\SyliusRichEditorPlugin\WysiwygEditor\EditorInterface; | ||
use Symfony\Component\Form\AbstractType; | ||
use Symfony\Component\Form\FormBuilderInterface; | ||
use Symfony\Component\Validator\Constraints as Assert; | ||
|
||
#[AsUiElement( | ||
code: 'monsieurbiz_ui_elements.featured_text_ui_element', | ||
icon: 'font', | ||
title: 'monsieurbiz_ui_elements.ui_element.featured_text_ui_element.title', | ||
description: 'monsieurbiz_ui_elements.ui_element.featured_text_ui_element.description', | ||
templates: new TemplatesUiElement( | ||
adminRender: '@MonsieurBizSyliusUiElementsPlugin/Admin/UiElement/featured_text_ui_element.html.twig', | ||
frontRender: '@MonsieurBizSyliusUiElementsPlugin/Shop/UiElement/featured_text_ui_element.html.twig', | ||
), | ||
tags: [], | ||
wireframe: 'featured-text', | ||
)] | ||
class FeaturedTextUiElementType extends AbstractType | ||
{ | ||
/** | ||
* @SuppressWarnings(PHPMD.UnusedFormalParameter) | ||
*/ | ||
public function buildForm(FormBuilderInterface $builder, array $options): void | ||
{ | ||
$builder | ||
->add('content', WysiwygType::class, [ | ||
'label' => 'monsieurbiz_ui_elements.common.fields.content', | ||
'editor_height' => 120, | ||
'editor_toolbar_type' => EditorInterface::TOOLBAR_TYPE_CUSTOM, | ||
'editor_toolbar_buttons' => [ | ||
['undo', 'redo'], | ||
['bold', 'underline', 'italic', 'strike'], | ||
['fontColor', 'hiliteColor'], | ||
['removeFormat'], | ||
['link'], | ||
['showBlocks', 'codeView'], | ||
], | ||
'required' => true, | ||
'constraints' => [ | ||
new Assert\NotBlank(), | ||
], | ||
]) | ||
; | ||
} | ||
} |
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
10 changes: 10 additions & 0 deletions
10
src/Resources/views/Admin/UiElement/featured_text_ui_element.html.twig
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,10 @@ | ||
{# | ||
UI Element template | ||
type: featured_text_ui_element | ||
element fields: | ||
- content | ||
#} | ||
<div class="ui container" style="border-left: 4px solid black; padding-left: 10px"> | ||
{{ element.content|default('')|raw }} | ||
</div> | ||
<div class="ui divider hidden"></div> |
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
10 changes: 10 additions & 0 deletions
10
src/Resources/views/Shop/UiElement/featured_text_ui_element.html.twig
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,10 @@ | ||
{# | ||
UI Element template | ||
type: featured_text_ui_element | ||
element fields: | ||
- content | ||
#} | ||
<div class="ui container" style="border-left: 4px solid black; padding-left: 10px"> | ||
{{ element.content|default('')|raw }} | ||
</div> | ||
<div class="ui divider hidden"></div> |
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,3 @@ | ||
<svg width="230" height="100" viewBox="0 0 230 100" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||
<rect width="230" height="100" rx="5" fill="#7A8CCE" fill-opacity="0.1"></rect> | ||
</svg> |