-
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 remote-tracking branch 'origin/1.x' into 218-reset-password
- Loading branch information
Showing
64 changed files
with
463 additions
and
267 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?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\Asset\Attributes\Property; | ||
|
||
use OpenApi\Attributes\Property; | ||
use Pimcore\Bundle\StudioBackendBundle\Asset\Schema\Type\Image\ImageData; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
final class UpdateAssetImage extends Property | ||
{ | ||
public function __construct() | ||
{ | ||
parent::__construct( | ||
'image', | ||
ref: ImageData::class, | ||
type: 'object', | ||
nullable: true, | ||
); | ||
} | ||
} |
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
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,49 @@ | ||
<?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\Asset\Schema\Type\Image; | ||
|
||
use OpenApi\Attributes\Property; | ||
use OpenApi\Attributes\Schema; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
#[Schema( | ||
title: 'FocalPoint', | ||
type: 'object' | ||
)] | ||
final readonly class FocalPoint | ||
{ | ||
|
||
public function __construct( | ||
#[Property(description: 'x', type: 'integer', example: 50)] | ||
private int $x, | ||
#[Property(description: 'y', type: 'integer', example: 50)] | ||
private int $y, | ||
) { | ||
} | ||
|
||
public function getX(): int | ||
{ | ||
return $this->x; | ||
} | ||
|
||
public function getY(): int | ||
{ | ||
return $this->y; | ||
} | ||
} |
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,41 @@ | ||
<?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\Asset\Schema\Type\Image; | ||
|
||
use OpenApi\Attributes\Property; | ||
use OpenApi\Attributes\Schema; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
#[Schema( | ||
title: 'ImageData', | ||
type: 'object' | ||
)] | ||
final readonly class ImageData | ||
{ | ||
public function __construct( | ||
#[Property(ref: FocalPoint::class, description: 'focalPoint', type: 'object')] | ||
private array $focalPoint, | ||
) { | ||
} | ||
|
||
public function getFocalPoint(): array | ||
{ | ||
return $this->focalPoint; | ||
} | ||
} |
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,69 @@ | ||
<?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\Asset\Updater\Adapter; | ||
|
||
use Pimcore\Bundle\StudioBackendBundle\Updater\Adapter\UpdateAdapterInterface; | ||
use Pimcore\Bundle\StudioBackendBundle\Util\Constants\ElementTypes; | ||
use Pimcore\Model\Asset\Image; | ||
use Pimcore\Model\Element\ElementInterface; | ||
use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
#[AutoconfigureTag('pimcore.studio_backend.update_adapter')] | ||
final readonly class ImageAdapter implements UpdateAdapterInterface | ||
{ | ||
private const INDEX_KEY = 'image'; | ||
|
||
public function update(ElementInterface $element, array $data): void | ||
{ | ||
if (!$element instanceof Image) { | ||
return; | ||
} | ||
|
||
$this->checkFocalPoint($element, $data); | ||
|
||
} | ||
|
||
public function getIndexKey(): string | ||
{ | ||
return self::INDEX_KEY; | ||
} | ||
|
||
public function supportedElementTypes(): array | ||
{ | ||
return [ | ||
ElementTypes::TYPE_ASSET, | ||
]; | ||
} | ||
|
||
private function checkFocalPoint(Image $image, array $data): void | ||
{ | ||
if ( | ||
!array_key_exists(self::INDEX_KEY, $data) || | ||
!array_key_exists('focalPoint', $data[self::INDEX_KEY]) | ||
) { | ||
$image->removeCustomSetting('focalPointX'); | ||
$image->removeCustomSetting('focalPointY'); | ||
return; | ||
} | ||
|
||
$image->setCustomSetting('focalPointX', $data[self::INDEX_KEY]['focalPoint']['x']); | ||
$image->setCustomSetting('focalPointY', $data[self::INDEX_KEY]['focalPoint']['y']); | ||
} | ||
} |
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
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
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
Oops, something went wrong.