Skip to content

Commit

Permalink
read editmode state from editable object (#163)
Browse files Browse the repository at this point in the history
  • Loading branch information
solverat authored Oct 13, 2021
1 parent 90553ee commit f42b4de
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 11 deletions.
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ The Toolbox is a Kickstarter for your every day project. It provides some import
[![Join the chat at https://gitter.im/pimcore/pimcore](https://img.shields.io/gitter/room/pimcore/pimcore.svg?style=flat-square)](https://gitter.im/pimcore/pimcore)
[![Software License](https://img.shields.io/badge/license-GPLv3-brightgreen.svg?style=flat-square)](LICENSE.md)
[![Latest Release](https://img.shields.io/packagist/v/dachcom-digital/toolbox.svg?style=flat-square)](https://packagist.org/packages/dachcom-digital/toolbox)
[![Tests](https://img.shields.io/github/workflow/status/dachcom-digital/pimcore-toolbox/Codeception?style=flat-square&logo=github&label=codeception)](https://github.com/dachcom-digital/pimcore-toolbox/actions?query=workflow%3A%22Codeception%22)
[![PhpStan](https://img.shields.io/github/workflow/status/dachcom-digital/pimcore-toolbox/PHP%20Stan?style=flat-square&logo=github&label=phpstan%20level%204)](https://github.com/dachcom-digital/pimcore-toolbox/actions?query=workflow%3A%22PHP%20Stan%22)
[![Tests](https://img.shields.io/github/workflow/status/dachcom-digital/pimcore-toolbox/Codeception/master?style=flat-square&logo=github&label=codeception)](https://github.com/dachcom-digital/pimcore-toolbox/actions?query=workflow%3ACodeception+branch%3Amaster)
[![PhpStan](https://img.shields.io/github/workflow/status/dachcom-digital/pimcore-toolbox/PHP%20Stan/master?style=flat-square&logo=github&label=phpstan%20level%204)](https://github.com/dachcom-digital/pimcore-toolbox/actions?query=workflow%3A"PHP+Stan"+branch%3Amaster)

![Pimcore Toolbox](https://user-images.githubusercontent.com/700119/135613598-a9ef2c69-9a44-41cd-8542-596a0322d3da.png)

Expand All @@ -28,12 +28,11 @@ The Toolbox is a Kickstarter for your every day project. It provides some import
}
```

### Installation
- Execute: `$ bin/console pimcore:bundle:enable ToolboxBundle`
- Execute: `$ bin/console pimcore:bundle:install ToolboxBundle`

## Upgrading
- Execute: `$ bin/console doctrine:migrations:version --add --all --prefix 'ToolboxBundle\Migrations'`
- Execute: `$ bin/console doctrine:migrations:migrate --prefix 'ToolboxBundle\Migrations'`

## What's the meaning of Toolbox?
- create often used bricks in a second
Expand Down Expand Up @@ -97,7 +96,7 @@ The Toolbox provides a lot of [ready-to-use Bricks](docs/11_ElementsOverview.md)
- [Javascript Plugins](docs/80_Javascript.md)

## Pimcore Fixes / Overrides
- Fix the pimcore iframe [maskFrames](src/ToolboxBundle/Resources/public/js/document/edit.js#L8) bug (in some cases the iframe overlay field does not apply to the right position)
- Fix the pimcore iframe [maskFrames](src/ToolboxBundle/Resources/public/js/document/edit.js) bug (in some cases the iframe overlay field does not apply to the right position)
- Transforms all the brick config buttons (`pimcore_area_edit_button_*`) to more grateful ones.

## Copyright and license
Expand Down
2 changes: 1 addition & 1 deletion src/ToolboxBundle/Document/Areabrick/Columns/Columns.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function action(Info $info): ?Response
{
parent::action($info);

$editMode = $info->getParam('editmode');
$editMode = $info->getEditable()->getEditmode();

/** @var Checkbox $equalHeightElement */
$equalHeightElement = $this->getDocumentEditable($info->getDocument(), 'checkbox', 'equal_height');
Expand Down
2 changes: 1 addition & 1 deletion src/ToolboxBundle/Document/Areabrick/IFrame/IFrame.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function action(Info $info): ?Response

$isValid = true;
$errorMessage = null;
if (!empty($iFrameUrl) && $info->getParam('editmode') === true) {
if (!empty($iFrameUrl) && $info->getEditable()->getEditmode() === true) {
$response = $this->checkIfUrlIsEmbeddable($iFrameUrl);
if ($response !== true) {
$isValid = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ private function _buildSectionContent(Editable\Area\Info $info)
$areaBlock = sprintf($wrapContent, $areaBlock);
}

if ($info->getParam('editmode') === true) {
if ($info->getEditable()->getEditmode() === true) {
if ($containerWrapper === 'none' && str_contains($areaBlock, 'toolbox-columns')) {
$message = $this->translator->trans('You\'re using columns without a valid container wrapper.', [], 'admin');
$messageWrap = $this->templating->render('@Toolbox/helper/field-alert.' . $this->getTemplateSuffix(), [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function action(Info $info): ?Response

/** @var Checkbox $equalHeightElement */
$equalHeightElement = $this->getDocumentEditable($info->getDocument(), 'checkbox', 'equal_height');
$equalHeight = $equalHeightElement->isChecked() && !$info->getParam('editmode');
$equalHeight = $equalHeightElement->isChecked() && !$info->getEditable()->getEditmode();

$id = sprintf('%s-%s', $info->getId(), $info->getIndex());

Expand Down
2 changes: 1 addition & 1 deletion src/ToolboxBundle/Document/Areabrick/Video/Video.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function action(Info $info): ?Response
$playInLightBox = $videoTag->getShowAsLightBox() === true ? 'true' : 'false';
/** @var Checkbox $autoPlayElement */
$autoPlayElement = $this->getDocumentEditable($info->getDocument(), 'checkbox', 'autoplay');
$autoPlay = $autoPlayElement->isChecked() === true && !$info->getParam('editmode');
$autoPlay = $autoPlayElement->isChecked() === true && !$info->getEditable()->getEditmode();
$videoType = $videoTag->getVideoType();
$posterPath = null;
$poster = $videoTag->getPosterAsset();
Expand Down
2 changes: 1 addition & 1 deletion tests/_etc/config/app/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ framework:
mailer:
transports:
main: 'null://null'
newsletter: 'null://null'
pimcore_newsletter: 'null://null'
1 change: 1 addition & 0 deletions tests/unit.default/Areas/AbstractAreaTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ public function generateBackendArea($id)
$area = new Area();
$area->setName($id);
$area->setDocument($document);
$area->setEditmode(false);

$info = new Area\Info();
$info->setId($id);
Expand Down

0 comments on commit f42b4de

Please sign in to comment.