-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add deeplink to edit mode
- Loading branch information
Showing
8 changed files
with
83 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Neusta\Pimcore\AreabrickConfigBundle\Bricks\Populator; | ||
|
||
use Neusta\ConverterBundle\Converter\Context\GenericContext; | ||
use Neusta\ConverterBundle\Populator; | ||
use Neusta\Pimcore\AreabrickConfigBundle\Bricks\Model\Page; | ||
use Pimcore\Model\Document\Page as PimcorePage; | ||
|
||
/** | ||
* @implements Populator<PimcorePage, Page, GenericContext|null> | ||
*/ | ||
class BrickPageEditModeUrlPopulator implements Populator | ||
{ | ||
public function populate(object $target, object $source, ?object $ctx = null): void | ||
{ | ||
$target->editModeUrl = \sprintf('/admin/login/deeplink?document_%s_page', $source->getId()); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
{# Additional Properties of Brick #} | ||
{% if brick.additionalProperties is defined and brick.additionalProperties is not empty %} | ||
<td> | ||
{% for additionalProperty in brick.additionalProperties|default([]) %} | ||
{% if additionalProperty is defined and additionalProperty.propertyValue is not empty %} | ||
<li>{{ additionalProperty.propertyName }}:{{ additionalProperty.propertyValue }}</li> | ||
{% endif %} | ||
{% endfor %} | ||
{% for additionalProperty in brick.additionalProperties|default([]) %} | ||
{% if additionalProperty is defined and additionalProperty.propertyValue is not empty %} | ||
<li>{{ additionalProperty.propertyName }}:{{ additionalProperty.propertyValue }}</li> | ||
{% endif %} | ||
{% endfor %} | ||
</td> | ||
{% else %} | ||
{{ 'neusta_pimcore_areabrick_config.areabricks.overview.table.no_additional_properties'|trans }} | ||
<td> | ||
{{ 'neusta_pimcore_areabrick_config.areabricks.overview.table.no_additional_properties'|trans }} | ||
</td> | ||
{% endif %} |
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
43 changes: 43 additions & 0 deletions
43
tests/Unit/Bricks/Populator/BrickPageEditModeUrlPopulatorTest.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,43 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace App\Tests\AreabrickConfigBundle\Bricks\Populator; | ||
|
||
use Neusta\ConverterBundle\Populator; | ||
use Neusta\Pimcore\AreabrickConfigBundle\Bricks\Model\Page; | ||
use Neusta\Pimcore\AreabrickConfigBundle\Bricks\Populator\BrickPageEditModeUrlPopulator; | ||
use PHPUnit\Framework\TestCase; | ||
use Pimcore\Model\Document\Page as PimcorePage; | ||
use Prophecy\PhpUnit\ProphecyTrait; | ||
use Prophecy\Prophecy\ObjectProphecy; | ||
|
||
class BrickPageEditModeUrlPopulatorTest extends TestCase | ||
{ | ||
use ProphecyTrait; | ||
|
||
private Populator $populator; | ||
|
||
/** @var ObjectProphecy<PimcorePage> */ | ||
private $source; | ||
|
||
private Page $target; | ||
|
||
protected function setUp(): void | ||
{ | ||
$this->source = $this->prophesize(PimcorePage::class); | ||
$this->source->getId()->willReturn(123); | ||
|
||
$this->populator = new BrickPageEditModeUrlPopulator(); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function populate_regular_case(): void | ||
{ | ||
$this->target = new Page(); | ||
|
||
$this->populator->populate($this->target, $this->source->reveal()); | ||
|
||
self::assertEquals('/admin/login/deeplink?document_123_page', $this->target->editModeUrl); | ||
} | ||
} |