-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '1.x' into 597-data-object-editor-field-collections-with…
…-block-and-localized-fields-not-working
- Loading branch information
Showing
40 changed files
with
966 additions
and
68 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
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,82 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
/** | ||
* Pimcore | ||
* | ||
* This source file is available under two different licenses: | ||
* - GNU General Public License version 3 (GPLv3) | ||
* - Pimcore Commercial License (PCL) | ||
* Full copyright and license information is available in | ||
* LICENSE.md which is distributed with this source code. | ||
* | ||
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org) | ||
* @license http://www.pimcore.org/license GPLv3 and PCL | ||
*/ | ||
|
||
namespace Pimcore\Bundle\StudioBackendBundle\Class\Controller\ObjectBrick; | ||
|
||
use Exception; | ||
use OpenApi\Attributes\Get; | ||
use Pimcore\Bundle\StudioBackendBundle\Class\Schema\ObjectBrick\LayoutDefinition; | ||
use Pimcore\Bundle\StudioBackendBundle\Class\Service\ObjectBrick\LayoutDefinitionServiceInterface; | ||
use Pimcore\Bundle\StudioBackendBundle\Controller\AbstractApiController; | ||
use Pimcore\Bundle\StudioBackendBundle\Exception\Api\NotFoundException; | ||
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attribute\Parameter\Path\IdParameter; | ||
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attribute\Property\GenericCollection; | ||
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attribute\Response\Content\CollectionJson; | ||
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attribute\Response\DefaultResponses; | ||
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Attribute\Response\SuccessResponse; | ||
use Pimcore\Bundle\StudioBackendBundle\OpenApi\Config\Tags; | ||
use Pimcore\Bundle\StudioBackendBundle\Util\Constant\HttpResponseCodes; | ||
use Pimcore\Bundle\StudioBackendBundle\Util\Trait\PaginatedResponseTrait; | ||
use Symfony\Component\HttpFoundation\JsonResponse; | ||
use Symfony\Component\Routing\Attribute\Route; | ||
use Symfony\Component\Serializer\SerializerInterface; | ||
use function count; | ||
|
||
final class LayoutController extends AbstractApiController | ||
{ | ||
use PaginatedResponseTrait; | ||
|
||
public function __construct( | ||
SerializerInterface $serializer, | ||
private readonly LayoutDefinitionServiceInterface $layoutDefinitionService, | ||
) { | ||
parent::__construct($serializer); | ||
} | ||
|
||
/** | ||
* @throws Exception|NotFoundException | ||
*/ | ||
#[Route( | ||
'/class/object-brick/{objectId}/object/layout', | ||
name: 'pimcore_studio_api_class_object_brick_object_layout', | ||
methods: ['GET'] | ||
)] | ||
#[Get( | ||
path: self::PREFIX . '/class/object-brick/{objectId}/object/layout', | ||
operationId: 'class_object_brick_object_layout', | ||
description: 'class_object_brick_object_layout_description', | ||
summary: 'class_object_brick_object_layout_summary', | ||
tags: [Tags::ClassDefinition->value], | ||
)] | ||
#[IdParameter(name: 'objectId', required: true)] | ||
#[SuccessResponse( | ||
description: 'class_object_brick_object_layout_success_response', | ||
content: new CollectionJson(new GenericCollection(LayoutDefinition::class)) | ||
)] | ||
#[DefaultResponses([ | ||
HttpResponseCodes::NOT_FOUND, | ||
])] | ||
public function getObjectBrickLayoutForObject(int $objectId): JsonResponse | ||
{ | ||
$items = $this->layoutDefinitionService->getLayoutDefinitionsForObject($objectId); | ||
|
||
return $this->getPaginatedCollection( | ||
$this->serializer, | ||
$items, | ||
count($items), | ||
); | ||
} | ||
} |
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,35 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
/** | ||
* Pimcore | ||
* | ||
* This source file is available under two different licenses: | ||
* - GNU General Public License version 3 (GPLv3) | ||
* - Pimcore Commercial License (PCL) | ||
* Full copyright and license information is available in | ||
* LICENSE.md which is distributed with this source code. | ||
* | ||
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org) | ||
* @license http://www.pimcore.org/license GPLv3 and PCL | ||
*/ | ||
|
||
namespace Pimcore\Bundle\StudioBackendBundle\Class\Event\ObjectBrick; | ||
|
||
use Pimcore\Bundle\StudioBackendBundle\Class\Schema\ObjectBrick\LayoutDefinition; | ||
use Pimcore\Bundle\StudioBackendBundle\Event\AbstractPreResponseEvent; | ||
|
||
final class LayoutDefinitionEvent extends AbstractPreResponseEvent | ||
{ | ||
public const EVENT_NAME = 'pre_response.objectBrick.layout_definition'; | ||
|
||
public function __construct(private readonly LayoutDefinition $layoutDefinition) | ||
{ | ||
parent::__construct($this->layoutDefinition); | ||
} | ||
|
||
public function getLayoutDefinition(): LayoutDefinition | ||
{ | ||
return $this->layoutDefinition; | ||
} | ||
} |
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
45 changes: 45 additions & 0 deletions
45
src/Class/Hydrator/ObjectBrick/LayoutDefinitionHydrator.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,45 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
/** | ||
* Pimcore | ||
* | ||
* This source file is available under two different licenses: | ||
* - GNU General Public License version 3 (GPLv3) | ||
* - Pimcore Commercial License (PCL) | ||
* Full copyright and license information is available in | ||
* LICENSE.md which is distributed with this source code. | ||
* | ||
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org) | ||
* @license http://www.pimcore.org/license GPLv3 and PCL | ||
*/ | ||
|
||
namespace Pimcore\Bundle\StudioBackendBundle\Class\Hydrator\ObjectBrick; | ||
|
||
use Pimcore\Bundle\StudioBackendBundle\Class\Schema\ObjectBrick\LayoutDefinition; | ||
use Pimcore\Model\DataObject\Objectbrick\Definition as ObjectBrickDefinition; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
final class LayoutDefinitionHydrator implements LayoutDefinitionHydratorInterface | ||
{ | ||
public function hydrate(ObjectBrickDefinition $data): LayoutDefinition | ||
{ | ||
$layout = $data->getLayoutDefinitions(); | ||
|
||
return new LayoutDefinition( | ||
$data->getKey(), | ||
$layout->getDatatype(), | ||
$layout->getName(), | ||
$layout->getType(), | ||
$layout->getRegion(), | ||
$layout->getTitle(), | ||
$layout->getWidth(), | ||
$layout->getHeight(), | ||
$layout->getCollapsible(), | ||
$layout->getCollapsed(), | ||
$layout->getChildren(), | ||
); | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
src/Class/Hydrator/ObjectBrick/LayoutDefinitionHydratorInterface.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,28 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
/** | ||
* Pimcore | ||
* | ||
* This source file is available under two different licenses: | ||
* - GNU General Public License version 3 (GPLv3) | ||
* - Pimcore Commercial License (PCL) | ||
* Full copyright and license information is available in | ||
* LICENSE.md which is distributed with this source code. | ||
* | ||
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org) | ||
* @license http://www.pimcore.org/license GPLv3 and PCL | ||
*/ | ||
|
||
namespace Pimcore\Bundle\StudioBackendBundle\Class\Hydrator\ObjectBrick; | ||
|
||
use Pimcore\Bundle\StudioBackendBundle\Class\Schema\ObjectBrick\LayoutDefinition; | ||
use Pimcore\Model\DataObject\Objectbrick\Definition as ObjectBrickDefinition; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
interface LayoutDefinitionHydratorInterface | ||
{ | ||
public function hydrate(ObjectBrickDefinition $data): LayoutDefinition; | ||
} |
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
Oops, something went wrong.