From cecbee5db12503dde4c3cc5f018a072cc1bae88c Mon Sep 17 00:00:00 2001 From: lukmzig <30526586+lukmzig@users.noreply.github.com> Date: Thu, 23 Jan 2025 13:19:26 +0000 Subject: [PATCH] Apply php-cs-fixer changes --- src/DataObject/Data/Adapter/LocalizedFieldsAdapter.php | 4 +--- src/Security/Service/LanguageService.php | 6 ++++-- src/Security/Service/LanguageServiceInterface.php | 1 - src/Security/Service/SecurityService.php | 3 +-- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/DataObject/Data/Adapter/LocalizedFieldsAdapter.php b/src/DataObject/Data/Adapter/LocalizedFieldsAdapter.php index db44908f..88176554 100644 --- a/src/DataObject/Data/Adapter/LocalizedFieldsAdapter.php +++ b/src/DataObject/Data/Adapter/LocalizedFieldsAdapter.php @@ -190,8 +190,7 @@ public function getPreviewFieldData( mixed $value, Data $fieldDefinition, array $data - ): array - { + ): array { if (!$value instanceof Localizedfield || !$fieldDefinition instanceof Localizedfields) { return $data; } @@ -227,7 +226,6 @@ public function getPreviewFieldData( return $data; } - private function getAllowedLanguages( Concrete $element, array $languageData diff --git a/src/Security/Service/LanguageService.php b/src/Security/Service/LanguageService.php index b0c14a25..868b39dc 100644 --- a/src/Security/Service/LanguageService.php +++ b/src/Security/Service/LanguageService.php @@ -22,6 +22,8 @@ use Pimcore\Bundle\StudioBackendBundle\Util\Constant\ElementPermissions; use Pimcore\Model\DataObject; use Pimcore\Model\UserInterface; +use function in_array; +use function sprintf; /** * @internal @@ -39,8 +41,7 @@ public function getUserAllowedLanguages( UserInterface $user, string $permission, ?array $languages = null - ): array - { + ): array { if (!in_array($permission, ElementPermissions::LANGUAGE_PERMISSIONS)) { throw new InvalidArgumentException(sprintf('Invalid permission "%s"', $permission)); } @@ -61,6 +62,7 @@ public function getUserAllowedLanguages( private function getAllLanguages(): array { $validLanguages = $this->toolResolver->getValidLanguages(); + return array_merge($validLanguages, [MappingProperty::NOT_LOCALIZED_KEY]); } } diff --git a/src/Security/Service/LanguageServiceInterface.php b/src/Security/Service/LanguageServiceInterface.php index a89cb619..8d9e3472 100644 --- a/src/Security/Service/LanguageServiceInterface.php +++ b/src/Security/Service/LanguageServiceInterface.php @@ -30,5 +30,4 @@ public function getUserAllowedLanguages( string $permission, ?array $languages = null ): array; - } diff --git a/src/Security/Service/SecurityService.php b/src/Security/Service/SecurityService.php index 179e1725..e0d386b6 100644 --- a/src/Security/Service/SecurityService.php +++ b/src/Security/Service/SecurityService.php @@ -91,8 +91,7 @@ public function getSpecialDataObjectPermissions( DataObject $dataObject, UserInterface $user, string $permission - ): array - { + ): array { /** @var User $user * Because of isAllowed method in the GDI * */