Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add editor-config-bundle and make fragment configuration more simple #21

Open
wants to merge 8 commits into
base: v1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"symfony/dependency-injection": "^5.3",
"symfony/event-dispatcher": "^5.2",
"symfony/finder": "^5.2",
"symfony/http-kernel": "^5.3"
"symfony/http-kernel": "^5.3",
"teamneusta/pimcore-areabrick-config-bundle": "dev-main"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should wait for a v1.0 to be released before this is merged.

},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.11",
Expand Down
49 changes: 49 additions & 0 deletions src/DocumentAreabrick/Base/AbstractConfigurableAreabrick.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php declare(strict_types=1);

namespace Neusta\Pimcore\PresentationBundle\DocumentAreabrick\Base;

use Neusta\Pimcore\AreabrickConfigBundle\HasDialogBox;
use Neusta\Pimcore\AreabrickConfigBundle\DialogBoxBuilder;
use Pimcore\Extension\Document\Areabrick\AbstractTemplateAreabrick;
use Pimcore\Extension\Document\Areabrick\EditableDialogBoxInterface;
use Pimcore\Model\Document\Editable;
use Pimcore\Model\Document\Editable\Area\Info;

class AbstractConfigurableAreabrick extends AbstractTemplateAreabrick implements EditableDialogBoxInterface
{
/** @template-use HasDialogBox<DialogBoxBuilder> */
use HasDialogBox;

protected function createDialogBoxBuilder(Editable $area, ?Info $info): DialogBoxBuilder
{
return new DialogBoxBuilder();
}
Comment on lines +17 to +20
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to overwrite this, it's the same as the default in the trait.


protected function buildDialogBox(DialogBoxBuilder $dialogBox, Editable $area, ?Info $info): void
{
$dialogBox
->addTab('Fragment Settings',
$dialogBox->createSelect(
'fragment-style',
[
'none' => 'none',
'fade-in' => 'fade in',
'fade-out' => 'fade out',
'fade-up' => 'fade up',
'fade-in-then-out' => 'fade in then out',
'fade-in-then-semi-out' => 'fade in then semi out',
'grow' => 'grow',
'shrink' => 'shrink',
'strike' => 'strike',
'highlight-current-blue' => 'highlight current blue',
'highlight-red' => 'highlight red',
'highlight-blue' => 'highlight blue',
'highlight-green' => 'highlight green',
]
)
->setLabel('Fragments Style')
->setDefaultValue('none'),
$dialogBox->createNumeric('fragments-order', 0, 20),
);
}
}
4 changes: 2 additions & 2 deletions src/DocumentAreabrick/Code.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Neusta\Pimcore\PresentationBundle\DocumentAreabrick;

use Pimcore\Extension\Document\Areabrick\AbstractTemplateAreabrick;
use Neusta\Pimcore\PresentationBundle\DocumentAreabrick\Base\AbstractConfigurableAreabrick;

class Code extends AbstractTemplateAreabrick
class Code extends AbstractConfigurableAreabrick
{
public function getName(): string
{
Expand Down
4 changes: 2 additions & 2 deletions src/DocumentAreabrick/Header.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Neusta\Pimcore\PresentationBundle\DocumentAreabrick;

use Pimcore\Extension\Document\Areabrick\AbstractTemplateAreabrick;
use Neusta\Pimcore\PresentationBundle\DocumentAreabrick\Base\AbstractConfigurableAreabrick;

class Header extends AbstractTemplateAreabrick
class Header extends AbstractConfigurableAreabrick
{
public function getName(): string
{
Expand Down
4 changes: 2 additions & 2 deletions src/DocumentAreabrick/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Neusta\Pimcore\PresentationBundle\DocumentAreabrick;

use Pimcore\Extension\Document\Areabrick\AbstractTemplateAreabrick;
use Neusta\Pimcore\PresentationBundle\DocumentAreabrick\Base\AbstractConfigurableAreabrick;

class Image extends AbstractTemplateAreabrick
class Image extends AbstractConfigurableAreabrick
{
public function getName(): string
{
Expand Down
4 changes: 2 additions & 2 deletions src/DocumentAreabrick/Textarea.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Neusta\Pimcore\PresentationBundle\DocumentAreabrick;

use Pimcore\Extension\Document\Areabrick\AbstractTemplateAreabrick;
use Neusta\Pimcore\PresentationBundle\DocumentAreabrick\Base\AbstractConfigurableAreabrick;

class Textarea extends AbstractTemplateAreabrick
class Textarea extends AbstractConfigurableAreabrick
{
public function getName(): string
{
Expand Down
4 changes: 2 additions & 2 deletions src/DocumentAreabrick/Wysiwyg.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Neusta\Pimcore\PresentationBundle\DocumentAreabrick;

use Pimcore\Extension\Document\Areabrick\AbstractTemplateAreabrick;
use Neusta\Pimcore\PresentationBundle\DocumentAreabrick\Base\AbstractConfigurableAreabrick;

class Wysiwyg extends AbstractTemplateAreabrick
class Wysiwyg extends AbstractConfigurableAreabrick
{
public function getName(): string
{
Expand Down
42 changes: 0 additions & 42 deletions templates/Areas/fragmentWrap.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -7,45 +7,3 @@
{% set isFragment = fragmentStyle
? 'fragment'
: '' %}

<div class="brick-{{ brickName }} {{ isFragment }} {{ fragmentStyle }}" {{ fragmentOrder }}>
{% block brick %}{% endblock %}
</div>
Comment on lines -11 to -13
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this should be removed.


{% if editmode %}
<div class="brick-settings">
<h1>Brick settings</h1>

<div class="flex-container">
<div class="flex-child">
<h2>Fragments style</h2>
{{ pimcore_select('fragment-style',{
'store': [
['none', 'none'],
['fade-in', 'fade in'],
['fade-out', 'fade out'],
['fade-up', 'fade up'],
['fade-in-then-out', 'fade in then out'],
['fade-in-then-semi-out', 'fade in then semi out'],
['grow', 'grow'],
['shrink', 'shrink'],
['strike', 'strike'],
['highlight-current-blue', 'highlight current blue'],
['highlight-red', 'highlight red'],
['highlight-blue', 'highlight blue'],
['highlight-green', 'highlight green'],
],
'defaultValue': 'none'
}) }}
</div>

<div class="flex-child">
<h2>Fragments order</h2>
{{ pimcore_numeric('fragment-order', {
'minValue': 0,
'maxValue': 20
}) }}
</div>
</div>
</div>
{% endif %}