From 8c0ec4c8baa1efe2a84ee0acc5a7a3a320ab5c47 Mon Sep 17 00:00:00 2001 From: roadiz-ci Date: Fri, 21 Jun 2024 09:44:29 +0000 Subject: [PATCH] chore: Bumped --- .gitignore | 1 + .travis/backoffice_assets.sh | 5 + .travis/composer_install.sh | 4 + .travis/php_lint.sh | 5 + LICENSE.md | 2 +- composer.json | 58 ++++----- phpstan.neon | 7 +- .../AjaxAttributeValuesController.php | 3 +- .../AjaxEntitiesExplorerController.php | 24 +--- .../AjaxNodesExplorerController.php | 34 ++--- .../AjaxSearchNodesSourcesController.php | 2 +- src/Controllers/AbstractAdminController.php | 32 +++-- .../AbstractAdminWithBulkController.php | 5 +- .../Attributes/AttributeController.php | 16 +-- src/Controllers/CacheController.php | 9 +- .../CustomForms/CustomFormsController.php | 2 +- .../CustomFormsUtilsController.php | 8 +- .../DocumentTranslationsController.php | 119 +++++++++-------- .../Documents/DocumentsController.php | 51 ++++++-- src/Controllers/FoldersController.php | 5 +- src/Controllers/GroupsUtilsController.php | 15 ++- src/Controllers/LoginController.php | 8 +- src/Controllers/NodeTypeFieldsController.php | 20 +-- .../NodeTypes/NodeTypesController.php | 20 +-- .../NodeTypes/NodeTypesUtilsController.php | 22 +++- src/Controllers/Nodes/ExportController.php | 8 +- src/Controllers/Nodes/HistoryController.php | 2 +- .../Nodes/NodesAttributesController.php | 15 ++- src/Controllers/Nodes/NodesController.php | 7 +- .../Nodes/NodesSourcesController.php | 12 +- .../Nodes/NodesTreesController.php | 40 +++++- .../Nodes/NodesUtilsController.php | 8 +- src/Controllers/Nodes/TranstypeController.php | 9 +- src/Controllers/RolesUtilsController.php | 15 ++- src/Controllers/SearchController.php | 24 ++-- src/Controllers/SettingsController.php | 13 +- src/Controllers/SettingsUtilsController.php | 17 ++- .../Tags/TagMultiCreationController.php | 99 +++++++------- src/Controllers/Tags/TagsController.php | 38 +++--- src/Controllers/Tags/TagsUtilsController.php | 8 +- src/Controllers/TranslationsController.php | 9 +- src/Controllers/Users/UsersController.php | 15 +-- src/Controllers/WebhookController.php | 5 +- src/Forms/CustomFormType.php | 121 ------------------ src/Forms/DocumentEditType.php | 2 +- src/Forms/DocumentTranslationType.php | 8 +- .../NodeSource/NodeSourceCustomFormType.php | 2 +- .../NodeSource/NodeSourceDocumentType.php | 4 +- src/Forms/NodeSource/NodeSourceType.php | 2 +- src/Forms/NodeType.php | 2 +- src/Models/NodeModel.php | 6 +- src/Models/NodeSourceModel.php | 4 +- src/Resources/app/less/login/login.less | 40 +++--- .../panels/entries_panel/admin_entries.less | 37 +++--- .../less/panels/user_panel/user_panel.less | 83 ++++++------ .../app/less/responsive/less-768.less | 8 +- src/Resources/app/less/vars.less | 11 +- src/Resources/translations/helps.ar.xlf | 1 + src/Resources/translations/helps.de.xlf | 1 + src/Resources/translations/helps.en.xlf | 4 + src/Resources/translations/helps.es.xlf | 1 + src/Resources/translations/helps.fr.xlf | 4 + src/Resources/translations/helps.id.xlf | 4 + src/Resources/translations/helps.it.xlf | 1 + src/Resources/translations/helps.ru.xlf | 1 + src/Resources/translations/helps.sr.xlf | 1 + src/Resources/translations/helps.tr.xlf | 1 + src/Resources/translations/helps.uk.xlf | 1 + src/Resources/translations/helps.xlf | 4 + src/Resources/translations/helps.zh.xlf | 4 + src/Resources/translations/messages.ar.xlf | 4 + src/Resources/translations/messages.de.xlf | 4 + src/Resources/translations/messages.en.xlf | 9 ++ src/Resources/translations/messages.es.xlf | 9 ++ src/Resources/translations/messages.fr.xlf | 9 ++ src/Resources/translations/messages.id.xlf | 4 + src/Resources/translations/messages.it.xlf | 4 + src/Resources/translations/messages.ru.xlf | 4 + src/Resources/translations/messages.sr.xlf | 4 + src/Resources/translations/messages.tr.xlf | 4 + src/Resources/translations/messages.uk.xlf | 4 + src/Resources/translations/messages.xlf | 3 +- src/Resources/translations/messages.zh.xlf | 9 ++ .../views/admin/blocks/adminImage.html.twig | 2 +- .../views/admin/blocks/loginImage.html.twig | 2 +- src/Resources/views/forms.html.twig | 17 --- .../views/modules/history-item.html.twig | 23 ++-- .../views/panels/user_panel.html.twig | 38 ++---- .../views/partials/js-inject.html.twig | 4 +- .../views/partials/simple-js-inject.html.twig | 2 +- src/Resources/views/settings/list.html.twig | 2 +- src/Resources/views/users/user_row.html.twig | 21 +-- .../widgets/nodeTree/singleNode.html.twig | 4 +- src/RozierApp.php | 11 +- src/Traits/NodesTrait.php | 4 +- src/Utils/SessionListFilters.php | 68 ++++++++++ src/Widgets/NodeTreeWidget.php | 5 +- src/static/css/app.dea952832312ed7f5246.css | 2 +- .../css/app.dea952832312ed7f5246.css.map | 2 +- ...7fa87ef.js => app.b5dd3534c286ca89478a.js} | 0 ...87ef.js => simple.b5dd3534c286ca89478a.js} | 0 ...87ef.js => vendor.b5dd3534c286ca89478a.js} | 0 102 files changed, 810 insertions(+), 647 deletions(-) create mode 100644 .travis/backoffice_assets.sh create mode 100644 .travis/composer_install.sh create mode 100644 .travis/php_lint.sh delete mode 100644 src/Forms/CustomFormType.php create mode 100644 src/Utils/SessionListFilters.php rename src/static/js/{app.28b7dd745d0e77fa87ef.js => app.b5dd3534c286ca89478a.js} (100%) rename src/static/js/{simple.28b7dd745d0e77fa87ef.js => simple.b5dd3534c286ca89478a.js} (100%) rename src/static/js/{vendor.28b7dd745d0e77fa87ef.js => vendor.b5dd3534c286ca89478a.js} (100%) diff --git a/.gitignore b/.gitignore index 43469c37..ea8d6aa9 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ /dev.php /install.php /clear_cache.php +/pimple.json /assets project_env.sh diff --git a/.travis/backoffice_assets.sh b/.travis/backoffice_assets.sh new file mode 100644 index 00000000..92ba88c8 --- /dev/null +++ b/.travis/backoffice_assets.sh @@ -0,0 +1,5 @@ +#!/bin/sh -x +cd src || exit 1; +yarn install --pure-lockfile +yarn run install +yarn run build diff --git a/.travis/composer_install.sh b/.travis/composer_install.sh new file mode 100644 index 00000000..628aaebb --- /dev/null +++ b/.travis/composer_install.sh @@ -0,0 +1,4 @@ +#!/bin/sh -x +phpenv config-rm xdebug.ini; +curl -s http://getcomposer.org/installer | php; +php composer.phar install --dev --no-interaction; diff --git a/.travis/php_lint.sh b/.travis/php_lint.sh new file mode 100644 index 00000000..624af292 --- /dev/null +++ b/.travis/php_lint.sh @@ -0,0 +1,5 @@ +#!/bin/sh -x +vendor/bin/phpcs --report=full --report-file=./report.txt -p ./ || exit 1; +vendor/bin/phpstan analyse -c phpstan.neon || exit 1; +#vendor/bin/console lint:twig || exit 1; +#vendor/bin/console lint:twig src/Resources/views || exit 1; diff --git a/LICENSE.md b/LICENSE.md index 01cd7778..747e48b2 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright © 2024 Ambroise Maupate, Julien Blanchet +Copyright © 2023 Ambroise Maupate, Julien Blanchet Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/composer.json b/composer.json index e5bbf990..0d18956c 100644 --- a/composer.json +++ b/composer.json @@ -28,48 +28,48 @@ "role": "Frontend developer" } ], - "minimum-stability": "dev", "prefer-stable": true, "require": { "php": ">=8.1", "ext-zip": "*", - "doctrine/orm": "~2.19.0", + "doctrine/orm": "~2.17.0", "guzzlehttp/guzzle": "^7.2.0", "jms/serializer": "^3.9.0", "league/flysystem": "^3.0", + "pimple/pimple": "^3.3.1", "ramsey/uuid": "^4.7", - "roadiz/compat-bundle": "2.3.*", - "roadiz/core-bundle": "2.3.*", - "roadiz/doc-generator": "2.3.*", - "roadiz/documents": "2.3.*", - "roadiz/dts-generator": "2.3.*", - "roadiz/markdown": "2.3.*", - "roadiz/models": "2.3.*", + "roadiz/compat-bundle": "2.2.*", + "roadiz/core-bundle": "2.2.*", + "roadiz/doc-generator": "2.2.*", + "roadiz/documents": "2.2.*", + "roadiz/dts-generator": "2.2.*", + "roadiz/markdown": "2.2.*", + "roadiz/models": "2.2.*", "roadiz/nodetype-contracts": "~1.1.2", - "roadiz/openid": "2.3.*", - "roadiz/rozier-bundle": "2.3.*", - "symfony/asset": "6.4.*", - "symfony/filesystem": "6.4.*", - "symfony/form": "6.4.*", - "symfony/http-foundation": "6.4.*", - "symfony/http-kernel": "6.4.*", - "symfony/routing": "6.4.*", - "symfony/security-core": "6.4.*", - "symfony/security-csrf": "6.4.*", - "symfony/security-http": "6.4.*", - "symfony/translation": "6.4.*", - "symfony/validator": "6.4.*", - "symfony/workflow": "6.4.*", - "symfony/yaml": "6.4.*", + "roadiz/openid": "2.2.*", + "roadiz/rozier-bundle": "2.2.*", + "symfony/asset": "5.4.*", + "symfony/filesystem": "5.4.*", + "symfony/form": "5.4.*", + "symfony/http-foundation": "5.4.*", + "symfony/http-kernel": "5.4.*", + "symfony/routing": "5.4.*", + "symfony/security-core": "5.4.*", + "symfony/security-csrf": "5.4.*", + "symfony/security-http": "5.4.*", + "symfony/translation": "5.4.*", + "symfony/validator": "5.4.*", + "symfony/workflow": "5.4.*", + "symfony/yaml": "5.4.*", "twig/twig": "^3.1" }, "require-dev": { "php-coveralls/php-coveralls": "^2.4", "phpstan/phpstan": "^1.5.3", "phpstan/phpstan-doctrine": "^1.3", - "roadiz/entity-generator": "2.3.*", - "roadiz/random": "2.3.*", - "roadiz/jwt": "2.3.*", + "roadiz/entity-generator": "2.2.*", + "roadiz/random": "2.2.*", + "roadiz/jwt": "2.2.*", "squizlabs/php_codesniffer": "^3.5" }, "autoload": { @@ -95,8 +95,8 @@ }, "extra": { "branch-alias": { - "dev-main": "2.3.x-dev", - "dev-develop": "2.4.x-dev" + "dev-main": "2.2.x-dev", + "dev-develop": "2.3.x-dev" } } } diff --git a/phpstan.neon b/phpstan.neon index 6693cc61..10dbac08 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,5 +1,5 @@ parameters: - level: 7 + level: 6 paths: - src excludePaths: @@ -9,8 +9,6 @@ parameters: doctrine: repositoryClass: RZ\Roadiz\Core\Repositories\EntityRepository ignoreErrors: - - identifier: missingType.iterableValue - - identifier: missingType.generics - '#Call to an undefined method RZ\\Roadiz\\CoreBundle\\Repository#' - '#Call to an undefined method RZ\\Roadiz\\UserBundle\\Repository#' - '#Call to an undefined method Doctrine\\Persistence\\ObjectRepository#' @@ -34,7 +32,8 @@ parameters: - '#does not accept Doctrine\\Common\\Collections\\ReadableCollection]+>#' reportUnmatchedIgnoredErrors: false - treatPhpDocTypesAsCertain: false + checkGenericClassInNonGenericObjectType: false + checkMissingIterableValueType: false includes: - vendor/phpstan/phpstan-doctrine/extension.neon diff --git a/src/AjaxControllers/AjaxAttributeValuesController.php b/src/AjaxControllers/AjaxAttributeValuesController.php index a4bc2108..bd3d34f3 100644 --- a/src/AjaxControllers/AjaxAttributeValuesController.php +++ b/src/AjaxControllers/AjaxAttributeValuesController.php @@ -5,6 +5,7 @@ namespace Themes\Rozier\AjaxControllers; use RZ\Roadiz\CoreBundle\Entity\AttributeValue; +use RZ\Roadiz\CoreBundle\Entity\Node; use RZ\Roadiz\CoreBundle\Security\Authorization\Voter\NodeVoter; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; @@ -68,7 +69,7 @@ protected function updatePosition(array $parameters, AttributeValue $attributeVa $attributable = $attributeValue->getAttributable(); $details = [ '%name%' => $attributeValue->getAttribute()->getLabelOrCode(), - '%nodeName%' => $attributable->getNodeName(), + '%nodeName%' => $attributable instanceof Node ? $attributable->getNodeName() : '', ]; if (!empty($parameters['afterAttributeValueId']) && is_numeric($parameters['afterAttributeValueId'])) { diff --git a/src/AjaxControllers/AjaxEntitiesExplorerController.php b/src/AjaxControllers/AjaxEntitiesExplorerController.php index 9ce0e969..e7fb58ce 100644 --- a/src/AjaxControllers/AjaxEntitiesExplorerController.php +++ b/src/AjaxControllers/AjaxEntitiesExplorerController.php @@ -18,7 +18,7 @@ use Symfony\Component\Config\Definition\Processor; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; +use Symfony\Component\Routing\Exception\InvalidParameterException; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Yaml\Yaml; use Themes\Rozier\Explorer\ConfigurableExplorerItem; @@ -46,7 +46,7 @@ protected function getFieldConfiguration(NodeTypeField $nodeTypeField): array $nodeTypeField->getType() !== AbstractField::MANY_TO_MANY_T && $nodeTypeField->getType() !== AbstractField::MANY_TO_ONE_T ) { - throw new BadRequestHttpException('nodeTypeField is not a valid entity join.'); + throw new InvalidParameterException('nodeTypeField is not a valid entity join.'); } $configs = [ @@ -63,16 +63,11 @@ public function indexAction(Request $request): JsonResponse $this->denyAccessUnlessGranted('ROLE_BACKEND_USER'); if (!$request->query->has('nodeTypeFieldId')) { - throw new BadRequestHttpException('nodeTypeFieldId parameter is missing.'); + throw new InvalidParameterException('nodeTypeFieldId parameter is missing.'); } - /** @var NodeTypeField|null $nodeTypeField */ + /** @var NodeTypeField $nodeTypeField */ $nodeTypeField = $this->em()->find(NodeTypeField::class, $request->query->get('nodeTypeFieldId')); - - if (null === $nodeTypeField) { - throw new BadRequestHttpException('nodeTypeField does not exist.'); - } - $configuration = $this->getFieldConfiguration($nodeTypeField); /** @var class-string $className */ $className = $configuration['classname']; @@ -117,11 +112,11 @@ public function indexAction(Request $request): JsonResponse public function listAction(Request $request): JsonResponse { if (!$request->query->has('nodeTypeFieldId')) { - throw new BadRequestHttpException('nodeTypeFieldId parameter is missing.'); + throw new InvalidParameterException('nodeTypeFieldId parameter is missing.'); } if (!$request->query->has('ids')) { - throw new BadRequestHttpException('Ids should be provided within an array'); + throw new InvalidParameterException('Ids should be provided within an array'); } $this->denyAccessUnlessGranted('ROLE_BACKEND_USER'); @@ -129,13 +124,8 @@ public function listAction(Request $request): JsonResponse /** @var EntityManager $em */ $em = $this->em(); - /** @var NodeTypeField|null $nodeTypeField */ + /** @var NodeTypeField $nodeTypeField */ $nodeTypeField = $this->em()->find(NodeTypeField::class, $request->query->get('nodeTypeFieldId')); - - if (null === $nodeTypeField) { - throw new BadRequestHttpException('nodeTypeField does not exist.'); - } - $configuration = $this->getFieldConfiguration($nodeTypeField); /** @var class-string $className */ $className = $configuration['classname']; diff --git a/src/AjaxControllers/AjaxNodesExplorerController.php b/src/AjaxControllers/AjaxNodesExplorerController.php index 7efcfcd4..f9914e3c 100644 --- a/src/AjaxControllers/AjaxNodesExplorerController.php +++ b/src/AjaxControllers/AjaxNodesExplorerController.php @@ -14,14 +14,13 @@ use RZ\Roadiz\CoreBundle\EntityApi\NodeTypeApi; use RZ\Roadiz\CoreBundle\SearchEngine\ClientRegistry; use RZ\Roadiz\CoreBundle\SearchEngine\NodeSourceSearchHandlerInterface; -use RZ\Roadiz\CoreBundle\SearchEngine\SolrSearchResultItem; use RZ\Roadiz\CoreBundle\Security\Authorization\Voter\NodeVoter; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Exception\InvalidParameterException; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; -use Symfony\Bundle\SecurityBundle\Security; +use Symfony\Component\Security\Core\Security; use Themes\Rozier\Models\NodeModel; use Themes\Rozier\Models\NodeSourceModel; @@ -185,6 +184,7 @@ protected function getSolrSearchResults( $arrayFilter, $this->getItemPerPage(), true, + 2, (int) $currentPage ); $pageCount = ceil($results->getResultCount() / $this->getItemPerPage()); @@ -250,7 +250,7 @@ public function listAction(Request $request): JsonResponse /** * Normalize response Node list result. * - * @param iterable $nodes + * @param iterable $nodes * @return array */ private function normalizeNodes(iterable $nodes): array @@ -258,30 +258,24 @@ private function normalizeNodes(iterable $nodes): array $nodesArray = []; foreach ($nodes as $node) { - if ($node instanceof SolrSearchResultItem) { - $item = $node->getItem(); - if ($item instanceof NodesSources || $item instanceof Node) { - $this->normalizeItem($item, $nodesArray); + if (null !== $node) { + if ($node instanceof NodesSources) { + if (!key_exists($node->getNode()->getId(), $nodesArray)) { + $nodeModel = new NodeSourceModel($node, $this->urlGenerator, $this->security); + $nodesArray[$node->getNode()->getId()] = $nodeModel->toArray(); + } + } else { + if (!key_exists($node->getId(), $nodesArray)) { + $nodeModel = new NodeModel($node, $this->urlGenerator, $this->security); + $nodesArray[$node->getId()] = $nodeModel->toArray(); + } } - } else { - $this->normalizeItem($node, $nodesArray); } } return array_values($nodesArray); } - private function normalizeItem(NodesSources|Node $item, array &$nodesArray): void - { - if ($item instanceof NodesSources && !key_exists($item->getNode()->getId(), $nodesArray)) { - $nodeSourceModel = new NodeSourceModel($item, $this->urlGenerator, $this->security); - $nodesArray[$item->getNode()->getId()] = $nodeSourceModel->toArray(); - } elseif ($item instanceof Node && !key_exists($item->getId(), $nodesArray)) { - $nodeModel = new NodeModel($item, $this->urlGenerator, $this->security); - $nodesArray[$item->getId()] = $nodeModel->toArray(); - } - } - /** * @param array $data * @return JsonResponse diff --git a/src/AjaxControllers/AjaxSearchNodesSourcesController.php b/src/AjaxControllers/AjaxSearchNodesSourcesController.php index b8c34594..8f2e7115 100644 --- a/src/AjaxControllers/AjaxSearchNodesSourcesController.php +++ b/src/AjaxControllers/AjaxSearchNodesSourcesController.php @@ -14,7 +14,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; -use Symfony\Bundle\SecurityBundle\Security; +use Symfony\Component\Security\Core\Security; class AjaxSearchNodesSourcesController extends AbstractAjaxController { diff --git a/src/Controllers/AbstractAdminController.php b/src/Controllers/AbstractAdminController.php index 2d73a9ba..338f76b4 100644 --- a/src/Controllers/AbstractAdminController.php +++ b/src/Controllers/AbstractAdminController.php @@ -8,25 +8,33 @@ use JMS\Serializer\SerializationContext; use JMS\Serializer\SerializerInterface; use RZ\Roadiz\Core\AbstractEntities\PersistableInterface; -use RZ\Roadiz\CoreBundle\ListManager\SessionListFilters; use Symfony\Component\Form\Exception\InvalidConfigurationException; use Symfony\Component\Form\Extension\Core\Type\FormType; use Symfony\Component\HttpFoundation\JsonResponse; +use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\String\UnicodeString; use Symfony\Contracts\EventDispatcher\Event; use Themes\Rozier\RozierApp; +use Themes\Rozier\Utils\SessionListFilters; abstract class AbstractAdminController extends RozierApp { public const ITEM_PER_PAGE = 20; - public function __construct( - protected readonly SerializerInterface $serializer, - protected readonly UrlGeneratorInterface $urlGenerator - ) { + protected SerializerInterface $serializer; + protected UrlGeneratorInterface $urlGenerator; + + /** + * @param SerializerInterface $serializer + * @param UrlGeneratorInterface $urlGenerator + */ + public function __construct(SerializerInterface $serializer, UrlGeneratorInterface $urlGenerator) + { + $this->serializer = $serializer; + $this->urlGenerator = $urlGenerator; } /** @@ -93,7 +101,7 @@ protected function getRequiredExportRole(): string * @return Response|null * @throws \Twig\Error\RuntimeError */ - public function defaultAction(Request $request): ?Response + public function defaultAction(Request $request) { $this->denyAccessUnlessGranted($this->getRequiredListingRole()); $this->additionalAssignation($request); @@ -124,10 +132,10 @@ public function defaultAction(Request $request): ?Response /** * @param Request $request - * @return Response|null + * @return RedirectResponse|Response|null * @throws \Twig\Error\RuntimeError */ - public function addAction(Request $request): ?Response + public function addAction(Request $request) { $this->denyAccessUnlessGranted($this->getRequiredCreationRole()); $this->additionalAssignation($request); @@ -180,7 +188,7 @@ public function addAction(Request $request): ?Response * @return Response|null * @throws \Twig\Error\RuntimeError */ - public function editAction(Request $request, $id): ?Response + public function editAction(Request $request, $id) { $this->denyAccessUnlessGranted($this->getRequiredEditionRole()); $this->additionalAssignation($request); @@ -263,10 +271,10 @@ public function exportAction(Request $request): JsonResponse /** * @param Request $request * @param int|string $id Numeric ID or UUID - * @return Response|null + * @return RedirectResponse|Response|null * @throws \Twig\Error\RuntimeError */ - public function deleteAction(Request $request, $id): ?Response + public function deleteAction(Request $request, $id) { $this->denyAccessUnlessGranted($this->getRequiredDeletionRole()); $this->additionalAssignation($request); @@ -494,7 +502,7 @@ protected function getPostDeleteResponse(PersistableInterface $item): Response * @param T|iterable|array|null $event * @return T|iterable|array|null */ - protected function dispatchSingleOrMultipleEvent(mixed $event): object|array|null + protected function dispatchSingleOrMultipleEvent(mixed $event): mixed { if (null === $event) { return null; diff --git a/src/Controllers/AbstractAdminWithBulkController.php b/src/Controllers/AbstractAdminWithBulkController.php index 1efa45a5..059d22bc 100644 --- a/src/Controllers/AbstractAdminWithBulkController.php +++ b/src/Controllers/AbstractAdminWithBulkController.php @@ -17,12 +17,15 @@ abstract class AbstractAdminWithBulkController extends AbstractAdminController { + protected FormFactoryInterface $formFactory; + public function __construct( - protected readonly FormFactoryInterface $formFactory, + FormFactoryInterface $formFactory, SerializerInterface $serializer, UrlGeneratorInterface $urlGenerator ) { parent::__construct($serializer, $urlGenerator); + $this->formFactory = $formFactory; } protected function additionalAssignation(Request $request): void diff --git a/src/Controllers/Attributes/AttributeController.php b/src/Controllers/Attributes/AttributeController.php index 49883ec6..ffc952fe 100644 --- a/src/Controllers/Attributes/AttributeController.php +++ b/src/Controllers/Attributes/AttributeController.php @@ -21,15 +21,19 @@ class AttributeController extends AbstractAdminWithBulkController { + private AttributeImporter $attributeImporter; + public function __construct( - private readonly AttributeImporter $attributeImporter, + AttributeImporter $attributeImporter, FormFactoryInterface $formFactory, SerializerInterface $serializer, UrlGeneratorInterface $urlGenerator ) { parent::__construct($formFactory, $serializer, $urlGenerator); + $this->attributeImporter = $attributeImporter; } + /** * @inheritDoc */ @@ -157,21 +161,13 @@ public function importAction(Request $request): Response $file = $form->get('file')->getData(); if ($file->isValid()) { - $serializedData = \file_get_contents($file->getPathname()); + $serializedData = file_get_contents($file->getPathname()); if (false === $serializedData) { throw new \RuntimeException('Cannot read uploaded file.'); } $this->attributeImporter->import($serializedData); $this->em()->flush(); - - $msg = $this->getTranslator()->trans( - '%namespace%.imported', - [ - '%namespace%' => $this->getTranslator()->trans($this->getNamespace()) - ] - ); - $this->publishConfirmMessage($request, $msg); return $this->redirectToRoute('attributesHomePage'); } $form->addError(new FormError($this->getTranslator()->trans('file.not_uploaded'))); diff --git a/src/Controllers/CacheController.php b/src/Controllers/CacheController.php index e71f35a2..ead8047e 100644 --- a/src/Controllers/CacheController.php +++ b/src/Controllers/CacheController.php @@ -14,10 +14,15 @@ final class CacheController extends RozierApp { + private LoggerInterface $logger; + private CacheClearerInterface $cacheClearer; + public function __construct( - private readonly CacheClearerInterface $cacheClearer, - private readonly LoggerInterface $logger + CacheClearerInterface $cacheClearer, + LoggerInterface $logger ) { + $this->logger = $logger; + $this->cacheClearer = $cacheClearer; } public function deleteDoctrineCache(Request $request): Response diff --git a/src/Controllers/CustomForms/CustomFormsController.php b/src/Controllers/CustomForms/CustomFormsController.php index 042983c8..42537ebf 100644 --- a/src/Controllers/CustomForms/CustomFormsController.php +++ b/src/Controllers/CustomForms/CustomFormsController.php @@ -6,9 +6,9 @@ use RZ\Roadiz\Core\AbstractEntities\PersistableInterface; use RZ\Roadiz\CoreBundle\Entity\CustomForm; +use RZ\Roadiz\RozierBundle\Form\CustomFormType; use Symfony\Component\HttpFoundation\Request; use Themes\Rozier\Controllers\AbstractAdminWithBulkController; -use Themes\Rozier\Forms\CustomFormType; class CustomFormsController extends AbstractAdminWithBulkController { diff --git a/src/Controllers/CustomForms/CustomFormsUtilsController.php b/src/Controllers/CustomForms/CustomFormsUtilsController.php index 5c293ccb..11516b8a 100644 --- a/src/Controllers/CustomForms/CustomFormsUtilsController.php +++ b/src/Controllers/CustomForms/CustomFormsUtilsController.php @@ -16,8 +16,14 @@ class CustomFormsUtilsController extends RozierApp { - public function __construct(private readonly CustomFormAnswerSerializer $customFormAnswerSerializer) + private CustomFormAnswerSerializer $customFormAnswerSerializer; + + /** + * @param CustomFormAnswerSerializer $customFormAnswerSerializer + */ + public function __construct(CustomFormAnswerSerializer $customFormAnswerSerializer) { + $this->customFormAnswerSerializer = $customFormAnswerSerializer; } /** diff --git a/src/Controllers/Documents/DocumentTranslationsController.php b/src/Controllers/Documents/DocumentTranslationsController.php index e8c1138f..0fcb8cdc 100644 --- a/src/Controllers/Documents/DocumentTranslationsController.php +++ b/src/Controllers/Documents/DocumentTranslationsController.php @@ -12,7 +12,6 @@ use RZ\Roadiz\CoreBundle\Entity\Translation; use RZ\Roadiz\CoreBundle\Event\Document\DocumentTranslationUpdatedEvent; use Symfony\Component\Form\Extension\Core\Type\HiddenType; -use Symfony\Component\Form\FormInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Exception\ResourceNotFoundException; @@ -29,13 +28,13 @@ class DocumentTranslationsController extends RozierApp /** * @param Request $request - * @param int $documentId - * @param int|null $translationId + * @param int $documentId + * @param int|null $translationId * * @return Response * @throws RuntimeError */ - public function editAction(Request $request, int $documentId, ?int $translationId = null): Response + public function editAction(Request $request, int $documentId, ?int $translationId = null) { $this->denyAccessUnlessGranted('ROLE_ACCESS_DOCUMENTS'); @@ -63,65 +62,69 @@ public function editAction(Request $request, int $documentId, ?int $translationI $documentTr = $this->createDocumentTranslation($document, $translation); } - if ($documentTr === null || $document === null) { - throw new ResourceNotFoundException(); - } - - $this->assignation['document'] = $document; - $this->assignation['translation'] = $translation; - $this->assignation['documentTr'] = $documentTr; + if ($documentTr !== null && $document !== null) { + $this->assignation['document'] = $document; + $this->assignation['translation'] = $translation; + $this->assignation['documentTr'] = $documentTr; - /** - * Versioning - */ - if ($this->isGranted('ROLE_ACCESS_VERSIONS')) { - if (null !== $response = $this->handleVersions($request, $documentTr)) { - return $response; + /** + * Versioning + */ + if ($this->isGranted('ROLE_ACCESS_VERSIONS')) { + if (null !== $response = $this->handleVersions($request, $documentTr)) { + return $response; + } } - } - /* - * Handle main form - */ - $form = $this->createForm(DocumentTranslationType::class, $documentTr, [ - 'referer' => $this->getRequest()->get('referer'), - 'disabled' => $this->isReadOnly, - ]); - $form->handleRequest($request); + /* + * Handle main form + */ + $form = $this->createForm(DocumentTranslationType::class, $documentTr, [ + 'referer' => $this->getRequest()->get('referer'), + 'disabled' => $this->isReadOnly, + ]); + $form->handleRequest($request); - if ($form->isSubmitted() && $form->isValid()) { - $this->onPostUpdate($documentTr, $request); + if ($form->isSubmitted() && $form->isValid()) { + $this->onPostUpdate($documentTr, $request); - $routeParams = [ - 'documentId' => $document->getId(), - 'translationId' => $translationId, - ]; + $routeParams = [ + 'documentId' => $document->getId(), + 'translationId' => $translationId, + ]; - if ($form->get('referer')->getData()) { - $routeParams = array_merge($routeParams, [ - 'referer' => $form->get('referer')->getData() - ]); + if ($form->get('referer')->getData()) { + $routeParams = array_merge($routeParams, [ + 'referer' => $form->get('referer')->getData() + ]); + } + + /* + * Force redirect to avoid resending form when refreshing page + */ + return $this->redirectToRoute( + 'documentsMetaPage', + $routeParams + ); } - /* - * Force redirect to avoid resending form when refreshing page - */ - return $this->redirectToRoute( - 'documentsMetaPage', - $routeParams - ); - } + $this->assignation['form'] = $form->createView(); + $this->assignation['readOnly'] = $this->isReadOnly; - $this->assignation['form'] = $form->createView(); - $this->assignation['readOnly'] = $this->isReadOnly; + return $this->render('@RoadizRozier/document-translations/edit.html.twig', $this->assignation); + } - return $this->render('@RoadizRozier/document-translations/edit.html.twig', $this->assignation); + throw new ResourceNotFoundException(); } - protected function createDocumentTranslation( - Document $document, - TranslationInterface $translation - ): DocumentTranslation { + /** + * @param Document $document + * @param TranslationInterface $translation + * + * @return DocumentTranslation + */ + protected function createDocumentTranslation(Document $document, TranslationInterface $translation) + { $dt = new DocumentTranslation(); $dt->setDocument($document); $dt->setTranslation($translation); @@ -141,7 +144,7 @@ protected function createDocumentTranslation( * @return Response * @throws RuntimeError */ - public function deleteAction(Request $request, int $documentId, int $translationId): Response + public function deleteAction(Request $request, int $documentId, int $translationId) { $this->denyAccessUnlessGranted('ROLE_ACCESS_DOCUMENTS_DELETE'); @@ -198,7 +201,12 @@ public function deleteAction(Request $request, int $documentId, int $translation throw new ResourceNotFoundException(); } - private function buildDeleteForm(DocumentTranslation $doc): FormInterface + /** + * @param DocumentTranslation $doc + * + * @return \Symfony\Component\Form\FormInterface + */ + private function buildDeleteForm(DocumentTranslation $doc) { $defaults = [ 'documentTranslationId' => $doc->getId(), @@ -232,6 +240,11 @@ protected function onPostUpdate(PersistableInterface $entity, Request $request): } } + /** + * @param PersistableInterface $entity + * + * @return Response + */ protected function getPostUpdateRedirection(PersistableInterface $entity): ?Response { if ( diff --git a/src/Controllers/Documents/DocumentsController.php b/src/Controllers/Documents/DocumentsController.php index 2aa339c6..b049b5d3 100644 --- a/src/Controllers/Documents/DocumentsController.php +++ b/src/Controllers/Documents/DocumentsController.php @@ -19,7 +19,6 @@ use RZ\Roadiz\CoreBundle\Entity\Translation; use RZ\Roadiz\CoreBundle\EntityHandler\DocumentHandler; use RZ\Roadiz\CoreBundle\Exception\EntityAlreadyExistsException; -use RZ\Roadiz\CoreBundle\ListManager\SessionListFilters; use RZ\Roadiz\Documents\Events\DocumentCreatedEvent; use RZ\Roadiz\Documents\Events\DocumentDeletedEvent; use RZ\Roadiz\Documents\Events\DocumentFileUpdatedEvent; @@ -56,10 +55,23 @@ use Themes\Rozier\Forms\DocumentEmbedType; use Themes\Rozier\Models\DocumentModel; use Themes\Rozier\RozierApp; +use Themes\Rozier\Utils\SessionListFilters; use Twig\Error\RuntimeError; class DocumentsController extends RozierApp { + private array $documentPlatforms; + private DocumentFactory $documentFactory; + private HandlerFactoryInterface $handlerFactory; + private LoggerInterface $logger; + private RandomImageFinder $randomImageFinder; + private RendererInterface $renderer; + private DocumentUrlGeneratorInterface $documentUrlGenerator; + private UrlGeneratorInterface $urlGenerator; + private FilesystemOperator $documentsStorage; + private ?string $googleServerId; + private ?string $soundcloudClientId; + protected array $thumbnailFormat = [ 'quality' => 50, 'fit' => '128x128', @@ -69,21 +81,34 @@ class DocumentsController extends RozierApp 'controls' => false, 'loading' => 'lazy', ]; + private EmbedFinderFactory $embedFinderFactory; public function __construct( - private readonly array $documentPlatforms, - private readonly FilesystemOperator $documentsStorage, - private readonly HandlerFactoryInterface $handlerFactory, - private readonly LoggerInterface $logger, - private readonly RandomImageFinder $randomImageFinder, - private readonly DocumentFactory $documentFactory, - private readonly RendererInterface $renderer, - private readonly DocumentUrlGeneratorInterface $documentUrlGenerator, - private readonly UrlGeneratorInterface $urlGenerator, - private readonly EmbedFinderFactory $embedFinderFactory, - private readonly ?string $googleServerId = null, - private readonly ?string $soundcloudClientId = null + array $documentPlatforms, + FilesystemOperator $documentsStorage, + HandlerFactoryInterface $handlerFactory, + LoggerInterface $logger, + RandomImageFinder $randomImageFinder, + DocumentFactory $documentFactory, + RendererInterface $renderer, + DocumentUrlGeneratorInterface $documentUrlGenerator, + UrlGeneratorInterface $urlGenerator, + EmbedFinderFactory $embedFinderFactory, + ?string $googleServerId = null, + ?string $soundcloudClientId = null ) { + $this->documentPlatforms = $documentPlatforms; + $this->handlerFactory = $handlerFactory; + $this->logger = $logger; + $this->randomImageFinder = $randomImageFinder; + $this->documentFactory = $documentFactory; + $this->renderer = $renderer; + $this->documentUrlGenerator = $documentUrlGenerator; + $this->urlGenerator = $urlGenerator; + $this->googleServerId = $googleServerId; + $this->soundcloudClientId = $soundcloudClientId; + $this->documentsStorage = $documentsStorage; + $this->embedFinderFactory = $embedFinderFactory; } /** diff --git a/src/Controllers/FoldersController.php b/src/Controllers/FoldersController.php index c3e866b5..92b122db 100644 --- a/src/Controllers/FoldersController.php +++ b/src/Controllers/FoldersController.php @@ -25,8 +25,11 @@ class FoldersController extends RozierApp { - public function __construct(private readonly DocumentArchiver $documentArchiver) + private DocumentArchiver $documentArchiver; + + public function __construct(DocumentArchiver $documentArchiver) { + $this->documentArchiver = $documentArchiver; } public function indexAction(Request $request): Response diff --git a/src/Controllers/GroupsUtilsController.php b/src/Controllers/GroupsUtilsController.php index 25e6be3e..e090be63 100644 --- a/src/Controllers/GroupsUtilsController.php +++ b/src/Controllers/GroupsUtilsController.php @@ -20,10 +20,17 @@ class GroupsUtilsController extends RozierApp { - public function __construct( - private readonly SerializerInterface $serializer, - private readonly GroupsImporter $groupsImporter - ) { + private SerializerInterface $serializer; + private GroupsImporter $groupsImporter; + + /** + * @param SerializerInterface $serializer + * @param GroupsImporter $groupsImporter + */ + public function __construct(SerializerInterface $serializer, GroupsImporter $groupsImporter) + { + $this->serializer = $serializer; + $this->groupsImporter = $groupsImporter; } /** diff --git a/src/Controllers/LoginController.php b/src/Controllers/LoginController.php index 7dea01cb..5714ba77 100644 --- a/src/Controllers/LoginController.php +++ b/src/Controllers/LoginController.php @@ -41,9 +41,10 @@ public function imageAction(Request $request): Response 'quality' => 80, 'sharpen' => 5, ]); - return $response->setData([ + $response->setData([ 'url' => $this->documentUrlGenerator->getUrl() ]); + return $response; } } @@ -53,8 +54,9 @@ public function imageAction(Request $request): Response if (null !== $feed) { $url = $feed['url'] ?? $feed['urls']['regular'] ?? $feed['urls']['full'] ?? $feed['urls']['raw'] ?? null; } - return $response->setData([ - 'url' => $url ?? '/themes/Rozier/static/assets/img/default_login.jpg' + $response->setData([ + 'url' => '/themes/Rozier/static/assets/img/default_login.jpg' ]); + return $response; } } diff --git a/src/Controllers/NodeTypeFieldsController.php b/src/Controllers/NodeTypeFieldsController.php index 4bdcd44b..fad5a557 100644 --- a/src/Controllers/NodeTypeFieldsController.php +++ b/src/Controllers/NodeTypeFieldsController.php @@ -12,6 +12,7 @@ use Symfony\Component\Form\FormError; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\Messenger\Envelope; use Symfony\Component\Messenger\MessageBusInterface; use Symfony\Component\Routing\Exception\ResourceNotFoundException; @@ -21,10 +22,13 @@ class NodeTypeFieldsController extends RozierApp { - public function __construct( - private readonly bool $allowNodeTypeEdition, - private readonly MessageBusInterface $messageBus - ) { + private MessageBusInterface $messageBus; + private KernelInterface $kernel; + + public function __construct(KernelInterface $kernel, MessageBusInterface $messageBus) + { + $this->messageBus = $messageBus; + $this->kernel = $kernel; } /** @@ -78,7 +82,7 @@ public function editAction(Request $request, int $nodeTypeFieldId): Response $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { - if (!$this->allowNodeTypeEdition) { + if (!$this->kernel->isDebug()) { $form->addError(new FormError('You cannot edit node-type fields in production.')); } else { $this->em()->flush(); @@ -134,12 +138,12 @@ public function addAction(Request $request, int $nodeTypeId): Response $this->assignation['field'] = $field; $form = $this->createForm(NodeTypeFieldType::class, $field, [ - 'disabled' => !$this->allowNodeTypeEdition + 'disabled' => !$this->kernel->isDebug() ]); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { - if (!$this->allowNodeTypeEdition) { + if (!$this->kernel->isDebug()) { $form->addError(new FormError('You cannot add node-type fields in production.')); } else { try { @@ -194,7 +198,7 @@ public function deleteAction(Request $request, int $nodeTypeFieldId): Response $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { - if (!$this->allowNodeTypeEdition) { + if (!$this->kernel->isDebug()) { $form->addError(new FormError('You cannot delete node-type fields in production.')); } else { /** @var NodeType $nodeType */ diff --git a/src/Controllers/NodeTypes/NodeTypesController.php b/src/Controllers/NodeTypes/NodeTypesController.php index 58720914..3926d683 100644 --- a/src/Controllers/NodeTypes/NodeTypesController.php +++ b/src/Controllers/NodeTypes/NodeTypesController.php @@ -6,25 +6,29 @@ use RZ\Roadiz\CoreBundle\Entity\NodeType; use RZ\Roadiz\CoreBundle\Exception\EntityAlreadyExistsException; -use RZ\Roadiz\CoreBundle\ListManager\SessionListFilters; use RZ\Roadiz\CoreBundle\Message\DeleteNodeTypeMessage; use RZ\Roadiz\CoreBundle\Message\UpdateNodeTypeSchemaMessage; use Symfony\Component\Form\Extension\Core\Type\FormType; use Symfony\Component\Form\FormError; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\Messenger\Envelope; use Symfony\Component\Messenger\MessageBusInterface; use Themes\Rozier\Forms\NodeTypeType; use Themes\Rozier\RozierApp; +use Themes\Rozier\Utils\SessionListFilters; use Twig\Error\RuntimeError; class NodeTypesController extends RozierApp { - public function __construct( - private readonly bool $allowNodeTypeEdition, - private readonly MessageBusInterface $messageBus - ) { + private MessageBusInterface $messageBus; + private KernelInterface $kernel; + + public function __construct(KernelInterface $kernel, MessageBusInterface $messageBus) + { + $this->messageBus = $messageBus; + $this->kernel = $kernel; } public function indexAction(Request $request): Response @@ -108,12 +112,12 @@ public function addAction(Request $request): Response $nodeType = new NodeType(); $form = $this->createForm(NodeTypeType::class, $nodeType, [ - 'disabled' => !$this->allowNodeTypeEdition + 'disabled' => !$this->kernel->isDebug() ]); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { - if (!$this->allowNodeTypeEdition) { + if (!$this->kernel->isDebug()) { $form->addError(new FormError('You cannot create a node-type in production mode.')); } else { try { @@ -162,7 +166,7 @@ public function deleteAction(Request $request, int $nodeTypeId): Response $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { - if (!$this->allowNodeTypeEdition) { + if (!$this->kernel->isDebug()) { $form->addError(new FormError('You cannot delete a node-type in production mode.')); } else { $this->messageBus->dispatch(new Envelope(new DeleteNodeTypeMessage($nodeType->getId()))); diff --git a/src/Controllers/NodeTypes/NodeTypesUtilsController.php b/src/Controllers/NodeTypes/NodeTypesUtilsController.php index 059a6b13..b7c07e63 100644 --- a/src/Controllers/NodeTypes/NodeTypesUtilsController.php +++ b/src/Controllers/NodeTypes/NodeTypesUtilsController.php @@ -29,12 +29,21 @@ class NodeTypesUtilsController extends RozierApp { + private SerializerInterface $serializer; + private NodeTypes $nodeTypesBag; + private NodeTypesImporter $nodeTypesImporter; + private MessageBusInterface $messageBus; + public function __construct( - private readonly SerializerInterface $serializer, - private readonly NodeTypes $nodeTypesBag, - private readonly NodeTypesImporter $nodeTypesImporter, - private readonly MessageBusInterface $messageBus + SerializerInterface $serializer, + NodeTypes $nodeTypesBag, + NodeTypesImporter $nodeTypesImporter, + MessageBusInterface $messageBus ) { + $this->serializer = $serializer; + $this->nodeTypesBag = $nodeTypesBag; + $this->nodeTypesImporter = $nodeTypesImporter; + $this->messageBus = $messageBus; } /** @@ -72,6 +81,7 @@ public function exportJsonFileAction(Request $request, int $nodeTypeId): JsonRes /** * @param Request $request + * * @return BinaryFileResponse * @throws RuntimeError */ @@ -142,6 +152,10 @@ public function exportTypeScriptDeclarationAction(Request $request): Response return $response; } + /** + * @param Request $request + * @return BinaryFileResponse + */ public function exportAllAction(Request $request): BinaryFileResponse { $this->denyAccessUnlessGranted('ROLE_ACCESS_NODETYPES'); diff --git a/src/Controllers/Nodes/ExportController.php b/src/Controllers/Nodes/ExportController.php index 4ba71fd0..15549a66 100644 --- a/src/Controllers/Nodes/ExportController.php +++ b/src/Controllers/Nodes/ExportController.php @@ -17,8 +17,14 @@ class ExportController extends RozierApp { - public function __construct(private readonly NodeSourceXlsxSerializer $xlsxSerializer) + private NodeSourceXlsxSerializer $xlsxSerializer; + + /** + * @param NodeSourceXlsxSerializer $xlsxSerializer + */ + public function __construct(NodeSourceXlsxSerializer $xlsxSerializer) { + $this->xlsxSerializer = $xlsxSerializer; } /** diff --git a/src/Controllers/Nodes/HistoryController.php b/src/Controllers/Nodes/HistoryController.php index 6915d67e..0ed1677c 100644 --- a/src/Controllers/Nodes/HistoryController.php +++ b/src/Controllers/Nodes/HistoryController.php @@ -8,13 +8,13 @@ use RZ\Roadiz\CoreBundle\Entity\Node; use RZ\Roadiz\CoreBundle\Entity\Translation; use RZ\Roadiz\CoreBundle\ListManager\QueryBuilderListManager; -use RZ\Roadiz\CoreBundle\ListManager\SessionListFilters; use RZ\Roadiz\CoreBundle\Logger\Entity\Log; use RZ\Roadiz\CoreBundle\Security\Authorization\Voter\NodeVoter; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Exception\ResourceNotFoundException; use Themes\Rozier\RozierApp; +use Themes\Rozier\Utils\SessionListFilters; use Twig\Error\RuntimeError; class HistoryController extends RozierApp diff --git a/src/Controllers/Nodes/NodesAttributesController.php b/src/Controllers/Nodes/NodesAttributesController.php index f1dfe96e..4ccd94bb 100644 --- a/src/Controllers/Nodes/NodesAttributesController.php +++ b/src/Controllers/Nodes/NodesAttributesController.php @@ -14,7 +14,6 @@ use RZ\Roadiz\CoreBundle\Event\NodesSources\NodesSourcesUpdatedEvent; use RZ\Roadiz\CoreBundle\Form\AttributeValueTranslationType; use RZ\Roadiz\CoreBundle\Form\AttributeValueType; -use RZ\Roadiz\CoreBundle\Form\Error\FormErrorSerializer; use RZ\Roadiz\CoreBundle\Security\Authorization\Voter\NodeVoter; use Symfony\Component\Form\Extension\Core\Type\FormType; use Symfony\Component\Form\FormFactoryInterface; @@ -27,10 +26,14 @@ class NodesAttributesController extends RozierApp { - public function __construct( - private readonly FormFactoryInterface $formFactory, - private readonly FormErrorSerializer $formErrorSerializer - ) { + private FormFactoryInterface $formFactory; + + /** + * @param FormFactoryInterface $formFactory + */ + public function __construct(FormFactoryInterface $formFactory) + { + $this->formFactory = $formFactory; } /** @@ -137,7 +140,7 @@ public function editAction(Request $request, int $nodeId, int $translationId): R 'translationId' => $translation->getId(), ]); } else { - $errors = $this->formErrorSerializer->getErrorsAsArray($attributeValueTranslationForm); + $errors = $this->getErrorsAsArray($attributeValueTranslationForm); /* * Handle errors when Ajax POST requests */ diff --git a/src/Controllers/Nodes/NodesController.php b/src/Controllers/Nodes/NodesController.php index 482e097f..47fa8f37 100644 --- a/src/Controllers/Nodes/NodesController.php +++ b/src/Controllers/Nodes/NodesController.php @@ -18,7 +18,6 @@ use RZ\Roadiz\CoreBundle\Event\Node\NodeUndeletedEvent; use RZ\Roadiz\CoreBundle\Event\Node\NodeUpdatedEvent; use RZ\Roadiz\CoreBundle\Exception\EntityAlreadyExistsException; -use RZ\Roadiz\CoreBundle\ListManager\SessionListFilters; use RZ\Roadiz\CoreBundle\Node\Exception\SameNodeUrlException; use RZ\Roadiz\CoreBundle\Node\NodeFactory; use RZ\Roadiz\CoreBundle\Node\NodeMover; @@ -37,6 +36,7 @@ use Symfony\Component\Workflow\Registry; use Themes\Rozier\RozierApp; use Themes\Rozier\Traits\NodesTrait; +use Themes\Rozier\Utils\SessionListFilters; use Twig\Error\RuntimeError; final class NodesController extends RozierApp @@ -329,10 +329,7 @@ public function addAction(Request $request, int $nodeTypeId, ?int $translationId throw new ResourceNotFoundException(sprintf('Translation #%s does not exist.', $translationId)); } - $node = new Node(); - $node->setNodeType($type); - $node->setTtl($type->getDefaultTtl()); - + $node = new Node($type); $chroot = $this->nodeChrootResolver->getChroot($this->getUser()); if (null !== $chroot) { // If user is jailed in a node, prevent moving nodes out. diff --git a/src/Controllers/Nodes/NodesSourcesController.php b/src/Controllers/Nodes/NodesSourcesController.php index 980ed5f3..ce28da25 100644 --- a/src/Controllers/Nodes/NodesSourcesController.php +++ b/src/Controllers/Nodes/NodesSourcesController.php @@ -34,10 +34,13 @@ class NodesSourcesController extends RozierApp { use VersionedControllerTrait; - public function __construct( - private readonly JwtExtension $jwtExtension, - private readonly FormErrorSerializer $formErrorSerializer - ) { + private JwtExtension $jwtExtension; + private FormErrorSerializer $formErrorSerializer; + + public function __construct(JwtExtension $jwtExtension, FormErrorSerializer $formErrorSerializer) + { + $this->jwtExtension = $jwtExtension; + $this->formErrorSerializer = $formErrorSerializer; } /** @@ -238,6 +241,7 @@ public function removeAction(Request $request, int $nodeSourceId): Response $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { + /** @var Node $node */ $node = $ns->getNode(); /* * Dispatch event diff --git a/src/Controllers/Nodes/NodesTreesController.php b/src/Controllers/Nodes/NodesTreesController.php index 7604d5b6..085d4410 100644 --- a/src/Controllers/Nodes/NodesTreesController.php +++ b/src/Controllers/Nodes/NodesTreesController.php @@ -32,13 +32,31 @@ class NodesTreesController extends RozierApp { + private NodeChrootResolver $nodeChrootResolver; + private TreeWidgetFactory $treeWidgetFactory; + private FormFactoryInterface $formFactory; + private HandlerFactoryInterface $handlerFactory; + private Registry $workflowRegistry; + + /** + * @param NodeChrootResolver $nodeChrootResolver + * @param TreeWidgetFactory $treeWidgetFactory + * @param FormFactoryInterface $formFactory + * @param HandlerFactoryInterface $handlerFactory + * @param Registry $workflowRegistry + */ public function __construct( - private readonly NodeChrootResolver $nodeChrootResolver, - private readonly TreeWidgetFactory $treeWidgetFactory, - private readonly FormFactoryInterface $formFactory, - private readonly HandlerFactoryInterface $handlerFactory, - private readonly Registry $workflowRegistry + NodeChrootResolver $nodeChrootResolver, + TreeWidgetFactory $treeWidgetFactory, + FormFactoryInterface $formFactory, + HandlerFactoryInterface $handlerFactory, + Registry $workflowRegistry ) { + $this->nodeChrootResolver = $nodeChrootResolver; + $this->treeWidgetFactory = $treeWidgetFactory; + $this->formFactory = $formFactory; + $this->handlerFactory = $handlerFactory; + $this->workflowRegistry = $workflowRegistry; } /** @@ -341,7 +359,12 @@ private function bulkDeleteNodes(array $data) return $this->getTranslator()->trans('wrong.request'); } - private function bulkStatusNodes(array $data): string + /** + * @param array $data + * + * @return string + */ + private function bulkStatusNodes(array $data) { if (!empty($data['nodesIds'])) { $nodesIds = trim($data['nodesIds']); @@ -370,7 +393,10 @@ private function bulkStatusNodes(array $data): string return $this->getTranslator()->trans('wrong.request'); } - private function buildBulkTagForm(): FormInterface + /** + * @return FormInterface + */ + private function buildBulkTagForm() { /** @var FormBuilder $builder */ $builder = $this->formFactory diff --git a/src/Controllers/Nodes/NodesUtilsController.php b/src/Controllers/Nodes/NodesUtilsController.php index cf73e9fc..e2e293a9 100644 --- a/src/Controllers/Nodes/NodesUtilsController.php +++ b/src/Controllers/Nodes/NodesUtilsController.php @@ -16,8 +16,14 @@ class NodesUtilsController extends RozierApp { - public function __construct(private readonly NodeNamePolicyInterface $nodeNamePolicy) + private NodeNamePolicyInterface $nodeNamePolicy; + + /** + * @param NodeNamePolicyInterface $nodeNamePolicy + */ + public function __construct(NodeNamePolicyInterface $nodeNamePolicy) { + $this->nodeNamePolicy = $nodeNamePolicy; } /** diff --git a/src/Controllers/Nodes/TranstypeController.php b/src/Controllers/Nodes/TranstypeController.php index 7e3326ae..c8b51d90 100644 --- a/src/Controllers/Nodes/TranstypeController.php +++ b/src/Controllers/Nodes/TranstypeController.php @@ -10,6 +10,7 @@ use RZ\Roadiz\CoreBundle\Event\NodesSources\NodesSourcesUpdatedEvent; use RZ\Roadiz\CoreBundle\Node\NodeTranstyper; use RZ\Roadiz\CoreBundle\Security\Authorization\Voter\NodeVoter; +use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Exception\ResourceNotFoundException; @@ -19,8 +20,14 @@ class TranstypeController extends RozierApp { - public function __construct(private readonly NodeTranstyper $nodeTranstyper) + private NodeTranstyper $nodeTranstyper; + + /** + * @param NodeTranstyper $nodeTranstyper + */ + public function __construct(NodeTranstyper $nodeTranstyper) { + $this->nodeTranstyper = $nodeTranstyper; } /** diff --git a/src/Controllers/RolesUtilsController.php b/src/Controllers/RolesUtilsController.php index 4cc08dc7..f0a5907e 100644 --- a/src/Controllers/RolesUtilsController.php +++ b/src/Controllers/RolesUtilsController.php @@ -20,10 +20,17 @@ class RolesUtilsController extends RozierApp { - public function __construct( - private readonly SerializerInterface $serializer, - private readonly RolesImporter $rolesImporter - ) { + private SerializerInterface $serializer; + private RolesImporter $rolesImporter; + + /** + * @param SerializerInterface $serializer + * @param RolesImporter $rolesImporter + */ + public function __construct(SerializerInterface $serializer, RolesImporter $rolesImporter) + { + $this->serializer = $serializer; + $this->rolesImporter = $rolesImporter; } /** diff --git a/src/Controllers/SearchController.php b/src/Controllers/SearchController.php index 1cff1ec9..d6d4aecf 100644 --- a/src/Controllers/SearchController.php +++ b/src/Controllers/SearchController.php @@ -68,7 +68,7 @@ public function notBlank(mixed $var): bool * * @return array */ - protected function appendDateTimeCriteria(array &$data, string $fieldName): array + protected function appendDateTimeCriteria(array &$data, string $fieldName) { $date = $data[$fieldName]['compareDatetime']; if ($date instanceof DateTime) { @@ -86,10 +86,12 @@ protected function appendDateTimeCriteria(array &$data, string $fieldName): arra * @param string $prefix * @return mixed */ - protected function processCriteria($data, string $prefix = ""): mixed + protected function processCriteria($data, string $prefix = "") { if (!empty($data[$prefix . "nodeName"])) { - if (!isset($data[$prefix . "nodeName_exact"]) || $data[$prefix . "nodeName_exact"] !== true) { + if (isset($data[$prefix . "nodeName_exact"]) && $data[$prefix . "nodeName_exact"] === true) { + $data[$prefix . "nodeName"] = $data[$prefix . "nodeName"]; + } else { $data[$prefix . "nodeName"] = ["LIKE", "%" . $data[$prefix . "nodeName"] . "%"]; } } @@ -137,11 +139,11 @@ protected function processCriteria($data, string $prefix = ""): mixed } /** - * @param array $data + * @param array|\Traversable $data * @param NodeType $nodetype - * @return array + * @return mixed */ - protected function processCriteriaNodetype(array $data, NodeType $nodetype): array + protected function processCriteriaNodetype($data, NodeType $nodetype) { $fields = $nodetype->getFields(); foreach ($data as $key => $value) { @@ -195,7 +197,7 @@ protected function processCriteriaNodetype(array $data, NodeType $nodetype): arr * @return Response * @throws RuntimeError */ - public function searchNodeAction(Request $request): Response + public function searchNodeAction(Request $request) { $builder = $this->buildSimpleForm(''); $form = $this->addButtons($builder)->getForm(); @@ -251,12 +253,12 @@ public function searchNodeAction(Request $request): Response * @param Request $request * @param int $nodetypeId * - * @return Response + * @return null|RedirectResponse|Response * @throws Exception * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception * @throws RuntimeError */ - public function searchNodeSourceAction(Request $request, int $nodetypeId): Response + public function searchNodeSourceAction(Request $request, int $nodetypeId) { /** @var NodeType|null $nodetype */ $nodetype = $this->em()->find(NodeType::class, $nodetypeId); @@ -344,7 +346,7 @@ protected function addButtons(FormBuilderInterface $builder, bool $exportXlsx = * * @return null|RedirectResponse */ - protected function handleNodeTypeForm(FormInterface $nodeTypeForm): ?RedirectResponse + protected function handleNodeTypeForm(FormInterface $nodeTypeForm) { if ($nodeTypeForm->isSubmitted() && $nodeTypeForm->isValid()) { if (empty($nodeTypeForm->getData()['nodetype'])) { @@ -449,7 +451,7 @@ protected function handleNodeForm(FormInterface $form, NodeType $nodetype): ?Res * @throws Exception * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception */ - protected function getXlsxResults(NodeType $nodetype, iterable $entities): string + protected function getXlsxResults(NodeType $nodetype, $entities): string { $fields = $nodetype->getFields(); $keys = []; diff --git a/src/Controllers/SettingsController.php b/src/Controllers/SettingsController.php index 4a12ba8d..8a57e58d 100644 --- a/src/Controllers/SettingsController.php +++ b/src/Controllers/SettingsController.php @@ -15,7 +15,6 @@ use RZ\Roadiz\CoreBundle\Exception\EntityAlreadyExistsException; use RZ\Roadiz\CoreBundle\Form\Error\FormErrorSerializer; use RZ\Roadiz\CoreBundle\Form\SettingType; -use RZ\Roadiz\CoreBundle\ListManager\SessionListFilters; use Symfony\Component\Form\Extension\Core\Type\FormType; use Symfony\Component\Form\FormError; use Symfony\Component\Form\FormFactoryInterface; @@ -24,14 +23,18 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Exception\ResourceNotFoundException; use Themes\Rozier\RozierApp; +use Themes\Rozier\Utils\SessionListFilters; use Twig\Error\RuntimeError; class SettingsController extends RozierApp { - public function __construct( - private readonly FormFactoryInterface $formFactory, - private readonly FormErrorSerializer $formErrorSerializer - ) { + private FormFactoryInterface $formFactory; + private FormErrorSerializer $formErrorSerializer; + + public function __construct(FormFactoryInterface $formFactory, FormErrorSerializer $formErrorSerializer) + { + $this->formFactory = $formFactory; + $this->formErrorSerializer = $formErrorSerializer; } /** diff --git a/src/Controllers/SettingsUtilsController.php b/src/Controllers/SettingsUtilsController.php index 8d963eb4..dff29f0e 100644 --- a/src/Controllers/SettingsUtilsController.php +++ b/src/Controllers/SettingsUtilsController.php @@ -6,9 +6,9 @@ use JMS\Serializer\SerializationContext; use JMS\Serializer\SerializerInterface; +use RZ\Roadiz\CoreBundle\Importer\SettingsImporter; use RZ\Roadiz\CoreBundle\Entity\Setting; use RZ\Roadiz\CoreBundle\Entity\SettingGroup; -use RZ\Roadiz\CoreBundle\Importer\SettingsImporter; use RZ\Roadiz\Utils\StringHandler; use Symfony\Component\Form\Extension\Core\Type\FileType; use Symfony\Component\Form\FormError; @@ -21,10 +21,17 @@ class SettingsUtilsController extends RozierApp { - public function __construct( - private readonly SerializerInterface $serializer, - private readonly SettingsImporter $settingsImporter - ) { + private SerializerInterface $serializer; + private SettingsImporter $settingsImporter; + + /** + * @param SerializerInterface $serializer + * @param SettingsImporter $settingsImporter + */ + public function __construct(SerializerInterface $serializer, SettingsImporter $settingsImporter) + { + $this->serializer = $serializer; + $this->settingsImporter = $settingsImporter; } /** diff --git a/src/Controllers/Tags/TagMultiCreationController.php b/src/Controllers/Tags/TagMultiCreationController.php index fa8632b9..f71ddb4a 100644 --- a/src/Controllers/Tags/TagMultiCreationController.php +++ b/src/Controllers/Tags/TagMultiCreationController.php @@ -9,6 +9,7 @@ use RZ\Roadiz\CoreBundle\Event\Tag\TagCreatedEvent; use RZ\Roadiz\CoreBundle\Tag\TagFactory; use Symfony\Component\Form\FormError; +use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Exception\ResourceNotFoundException; @@ -17,73 +18,79 @@ class TagMultiCreationController extends RozierApp { - public function __construct(private readonly TagFactory $tagFactory) + private TagFactory $tagFactory; + + /** + * @param TagFactory $tagFactory + */ + public function __construct(TagFactory $tagFactory) { + $this->tagFactory = $tagFactory; } /** * @param Request $request * @param int $parentTagId - * @return Response + * @return RedirectResponse|Response|null * @throws \Twig\Error\RuntimeError */ - public function addChildAction(Request $request, int $parentTagId): Response + public function addChildAction(Request $request, int $parentTagId) { $this->denyAccessUnlessGranted('ROLE_ACCESS_TAGS'); $translation = $this->em()->getRepository(Translation::class)->findDefault(); $parentTag = $this->em()->find(Tag::class, $parentTagId); - if (null === $parentTag) { - throw new ResourceNotFoundException(); - } + if (null !== $parentTag) { + $form = $this->createForm(MultiTagType::class); + $form->handleRequest($request); - $form = $this->createForm(MultiTagType::class); - $form->handleRequest($request); - - if ($form->isSubmitted() && $form->isValid()) { - try { - $data = $form->getData(); - $names = explode(',', $data['names']); - $names = array_map('trim', $names); - $names = array_filter($names); - $names = array_unique($names); - - /* - * Get latest position to add tags after. - */ - $latestPosition = $this->em() - ->getRepository(Tag::class) - ->findLatestPositionInParent($parentTag); - - $tagsArray = []; - foreach ($names as $name) { - $tagsArray[] = $this->tagFactory->create($name, $translation, $parentTag, $latestPosition); - $this->em()->flush(); - } + if ($form->isSubmitted() && $form->isValid()) { + try { + $data = $form->getData(); + $names = explode(',', $data['names']); + $names = array_map('trim', $names); + $names = array_filter($names); + $names = array_unique($names); - /* - * Dispatch event and msg - */ - foreach ($tagsArray as $tag) { /* - * Dispatch event + * Get latest position to add tags after. */ - $this->dispatchEvent(new TagCreatedEvent($tag)); - $msg = $this->getTranslator()->trans('child.tag.%name%.created', ['%name%' => $tag->getTagName()]); - $this->publishConfirmMessage($request, $msg, $tag); - } + $latestPosition = $this->em() + ->getRepository(Tag::class) + ->findLatestPositionInParent($parentTag); + + $tagsArray = []; + foreach ($names as $name) { + $tagsArray[] = $this->tagFactory->create($name, $translation, $parentTag, $latestPosition); + $this->em()->flush(); + } - return $this->redirectToRoute('tagsTreePage', ['tagId' => $parentTagId]); - } catch (\InvalidArgumentException $e) { - $form->addError(new FormError($e->getMessage())); + /* + * Dispatch event and msg + */ + foreach ($tagsArray as $tag) { + /* + * Dispatch event + */ + $this->dispatchEvent(new TagCreatedEvent($tag)); + $msg = $this->getTranslator()->trans('child.tag.%name%.created', ['%name%' => $tag->getTagName()]); + $this->publishConfirmMessage($request, $msg, $tag); + } + + return $this->redirectToRoute('tagsTreePage', ['tagId' => $parentTagId]); + } catch (\InvalidArgumentException $e) { + $form->addError(new FormError($e->getMessage())); + } } - } - $this->assignation['translation'] = $translation; - $this->assignation['form'] = $form->createView(); - $this->assignation['tag'] = $parentTag; + $this->assignation['translation'] = $translation; + $this->assignation['form'] = $form->createView(); + $this->assignation['tag'] = $parentTag; + + return $this->render('@RoadizRozier/tags/add-multiple.html.twig', $this->assignation); + } - return $this->render('@RoadizRozier/tags/add-multiple.html.twig', $this->assignation); + throw new ResourceNotFoundException(); } } diff --git a/src/Controllers/Tags/TagsController.php b/src/Controllers/Tags/TagsController.php index 9a766e71..ca50fb93 100644 --- a/src/Controllers/Tags/TagsController.php +++ b/src/Controllers/Tags/TagsController.php @@ -15,7 +15,6 @@ use RZ\Roadiz\CoreBundle\Event\Tag\TagDeletedEvent; use RZ\Roadiz\CoreBundle\Event\Tag\TagUpdatedEvent; use RZ\Roadiz\CoreBundle\Exception\EntityAlreadyExistsException; -use RZ\Roadiz\CoreBundle\Form\Error\FormErrorSerializer; use RZ\Roadiz\CoreBundle\Repository\TranslationRepository; use RZ\Roadiz\Utils\StringHandler; use Symfony\Component\Form\Extension\Core\Type\HiddenType; @@ -40,12 +39,23 @@ class TagsController extends RozierApp { use VersionedControllerTrait; + private HandlerFactoryInterface $handlerFactory; + private FormFactoryInterface $formFactory; + private TreeWidgetFactory $treeWidgetFactory; + + /** + * @param FormFactoryInterface $formFactory + * @param HandlerFactoryInterface $handlerFactory + * @param TreeWidgetFactory $treeWidgetFactory + */ public function __construct( - private readonly FormFactoryInterface $formFactory, - private readonly FormErrorSerializer $formErrorSerializer, - private readonly HandlerFactoryInterface $handlerFactory, - private readonly TreeWidgetFactory $treeWidgetFactory + FormFactoryInterface $formFactory, + HandlerFactoryInterface $handlerFactory, + TreeWidgetFactory $treeWidgetFactory ) { + $this->handlerFactory = $handlerFactory; + $this->formFactory = $formFactory; + $this->treeWidgetFactory = $treeWidgetFactory; } /** @@ -204,7 +214,7 @@ public function editTranslatedAction(Request $request, int $tagId, ?int $transla * Handle errors when Ajax POST requests */ if ($isJsonRequest) { - $errors = $this->formErrorSerializer->getErrorsAsArray($form); + $errors = $this->getErrorsAsArray($form); return new JsonResponse([ 'status' => 'fail', 'errors' => $errors, @@ -294,8 +304,8 @@ public function bulkDeleteAction(Request $request): Response /** * @param Request $request + * * @return Response - * @throws RuntimeError */ public function addAction(Request $request): Response { @@ -351,7 +361,6 @@ public function addAction(Request $request): Response * @param int $tagId * * @return Response - * @throws RuntimeError */ public function editSettingsAction(Request $request, int $tagId): Response { @@ -399,7 +408,7 @@ public function editSettingsAction(Request $request, int $tagId): Response * Handle errors when Ajax POST requests */ if ($isJsonRequest) { - $errors = $this->formErrorSerializer->getErrorsAsArray($form); + $errors = $this->getErrorsAsArray($form); return new JsonResponse([ 'status' => 'fail', 'errors' => $errors, @@ -421,7 +430,6 @@ public function editSettingsAction(Request $request, int $tagId): Response * @param int|null $translationId * * @return Response - * @throws RuntimeError */ public function treeAction(Request $request, int $tagId, ?int $translationId = null): Response { @@ -453,10 +461,9 @@ public function treeAction(Request $request, int $tagId, ?int $translationId = n * Return a deletion form for requested tag. * * @param Request $request - * @param int $tagId + * @param int $tagId * * @return Response - * @throws RuntimeError */ public function deleteAction(Request $request, int $tagId): Response { @@ -516,7 +523,6 @@ public function deleteAction(Request $request, int $tagId): Response * @param int|null $translationId * * @return Response - * @throws RuntimeError */ public function addChildAction(Request $request, int $tagId, ?int $translationId = null): Response { @@ -643,13 +649,13 @@ private function buildDeleteForm(Tag $tag): FormInterface } /** - * @param null|string $referer + * @param false|string $referer * @param array $tagsIds * * @return FormInterface */ private function buildBulkDeleteForm( - ?string $referer = null, + $referer = false, array $tagsIds = [] ): FormInterface { $builder = $this->formFactory @@ -663,7 +669,7 @@ private function buildBulkDeleteForm( ], ]); - if (null !== $referer && (new UnicodeString($referer))->startsWith('/')) { + if (false !== $referer && (new UnicodeString($referer))->startsWith('/')) { $builder->add('referer', HiddenType::class, [ 'data' => $referer, ]); diff --git a/src/Controllers/Tags/TagsUtilsController.php b/src/Controllers/Tags/TagsUtilsController.php index 71f96693..1108a87d 100644 --- a/src/Controllers/Tags/TagsUtilsController.php +++ b/src/Controllers/Tags/TagsUtilsController.php @@ -14,8 +14,14 @@ class TagsUtilsController extends RozierApp { - public function __construct(private readonly SerializerInterface $serializer) + private SerializerInterface $serializer; + + /** + * @param SerializerInterface $serializer + */ + public function __construct(SerializerInterface $serializer) { + $this->serializer = $serializer; } /** diff --git a/src/Controllers/TranslationsController.php b/src/Controllers/TranslationsController.php index 601c24b1..968a268e 100644 --- a/src/Controllers/TranslationsController.php +++ b/src/Controllers/TranslationsController.php @@ -4,12 +4,12 @@ namespace Themes\Rozier\Controllers; -use RZ\Roadiz\Core\Handlers\HandlerFactoryInterface; use RZ\Roadiz\CoreBundle\Entity\Translation; -use RZ\Roadiz\CoreBundle\EntityHandler\TranslationHandler; use RZ\Roadiz\CoreBundle\Event\Translation\TranslationCreatedEvent; use RZ\Roadiz\CoreBundle\Event\Translation\TranslationDeletedEvent; use RZ\Roadiz\CoreBundle\Event\Translation\TranslationUpdatedEvent; +use RZ\Roadiz\Core\Handlers\HandlerFactoryInterface; +use RZ\Roadiz\CoreBundle\EntityHandler\TranslationHandler; use Symfony\Component\Form\Extension\Core\Type\FormType; use Symfony\Component\Form\FormError; use Symfony\Component\HttpFoundation\Request; @@ -23,8 +23,11 @@ class TranslationsController extends RozierApp { public const ITEM_PER_PAGE = 5; - public function __construct(private readonly HandlerFactoryInterface $handlerFactory) + private HandlerFactoryInterface $handlerFactory; + + public function __construct(HandlerFactoryInterface $handlerFactory) { + $this->handlerFactory = $handlerFactory; } /** diff --git a/src/Controllers/Users/UsersController.php b/src/Controllers/Users/UsersController.php index a2ded208..dc6999df 100644 --- a/src/Controllers/Users/UsersController.php +++ b/src/Controllers/Users/UsersController.php @@ -4,15 +4,12 @@ namespace Themes\Rozier\Controllers\Users; -use JMS\Serializer\SerializerInterface; use RZ\Roadiz\Core\AbstractEntities\PersistableInterface; use RZ\Roadiz\CoreBundle\Entity\Role; use RZ\Roadiz\CoreBundle\Entity\User; -use Symfony\Component\Form\FormFactoryInterface; use Symfony\Component\Form\FormInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Themes\Rozier\Controllers\AbstractAdminWithBulkController; use Themes\Rozier\Forms\UserDetailsType; use Themes\Rozier\Forms\UserType; @@ -20,16 +17,6 @@ class UsersController extends AbstractAdminWithBulkController { - public function __construct( - FormFactoryInterface $formFactory, - SerializerInterface $serializer, - UrlGeneratorInterface $urlGenerator, - private readonly bool $useGravatar - ) { - parent::__construct($formFactory, $serializer, $urlGenerator); - } - - protected function supports(PersistableInterface $item): bool { return $item instanceof User; @@ -136,7 +123,7 @@ protected function createUpdateEvent(PersistableInterface $item) /* * If pictureUrl is empty, use default Gravatar image. */ - if ($item->getPictureUrl() == '' && $this->useGravatar) { + if ($item->getPictureUrl() == '') { $item->setPictureUrl($item->getGravatarUrl()); } diff --git a/src/Controllers/WebhookController.php b/src/Controllers/WebhookController.php index 60bccc70..b67c79f7 100644 --- a/src/Controllers/WebhookController.php +++ b/src/Controllers/WebhookController.php @@ -19,13 +19,16 @@ final class WebhookController extends AbstractAdminWithBulkController { + private WebhookDispatcher $webhookDispatcher; + public function __construct( - private readonly WebhookDispatcher $webhookDispatcher, + WebhookDispatcher $webhookDispatcher, FormFactoryInterface $formFactory, SerializerInterface $serializer, UrlGeneratorInterface $urlGenerator ) { parent::__construct($formFactory, $serializer, $urlGenerator); + $this->webhookDispatcher = $webhookDispatcher; } public function triggerAction(Request $request, string $id): Response diff --git a/src/Forms/CustomFormType.php b/src/Forms/CustomFormType.php deleted file mode 100644 index 57858f3b..00000000 --- a/src/Forms/CustomFormType.php +++ /dev/null @@ -1,121 +0,0 @@ -security = $security; - } - - public function buildForm(FormBuilderInterface $builder, array $options): void - { - $builder->add('displayName', TextType::class, [ - 'label' => 'customForm.displayName', - 'empty_data' => '', - ]) - ->add('description', MarkdownType::class, [ - 'label' => 'description', - 'required' => false, - ]) - ->add('email', TextType::class, [ - 'label' => 'email', - 'required' => false, - 'constraints' => [ - new Callback(function ($value, ExecutionContextInterface $context) { - $emails = array_filter( - array_map('trim', explode(',', $value ?? '')) - ); - foreach ($emails as $email) { - if (false === filter_var($email, FILTER_VALIDATE_EMAIL)) { - $context->buildViolation('{{ value }} is not a valid email address.') - ->setParameter('{{ value }}', $email) - ->setCode(Email::INVALID_FORMAT_ERROR) - ->addViolation(); - } - } - }), - ], - ]) - ; - if ($this->security->isGranted('ROLE_ACCESS_CUSTOMFORMS_RETENTION')) { - $builder->add('retentionTime', ChoiceType::class, [ - 'label' => 'customForm.retentionTime', - 'help' => 'customForm.retentionTime.help', - 'required' => false, - 'placeholder' => 'customForm.retentionTime.always', - 'choices' => [ - 'customForm.retentionTime.one_week' => 'P7D', - 'customForm.retentionTime.two_weeks' => 'P14D', - 'customForm.retentionTime.one_month' => 'P1M', - 'customForm.retentionTime.three_months' => 'P3M', - 'customForm.retentionTime.six_months' => 'P6M', - 'customForm.retentionTime.one_year' => 'P1Y', - 'customForm.retentionTime.two_years' => 'P2Y', - ] - ]); - } - $builder->add('open', CheckboxType::class, [ - 'label' => 'customForm.open', - 'required' => false, - ]) - ->add('closeDate', DateTimeType::class, [ - 'label' => 'customForm.closeDate', - 'required' => false, - 'date_widget' => 'single_text', - 'date_format' => 'yyyy-MM-dd', - 'attr' => [ - 'class' => 'rz-datetime-field', - ], - 'placeholder' => [ - 'hour' => 'hour', - 'minute' => 'minute', - ], - ]) - ->add('color', ColorType::class, [ - 'label' => 'customForm.color', - 'required' => false, - ]); - } - - public function getBlockPrefix(): string - { - return 'customform'; - } - - public function configureOptions(OptionsResolver $resolver): void - { - $resolver->setDefaults([ - 'label' => false, - 'name' => '', - 'data_class' => CustomForm::class, - 'attr' => [ - 'class' => 'uk-form custom-form-form', - ], - ]); - $resolver->setAllowedTypes('name', 'string'); - } -} diff --git a/src/Forms/DocumentEditType.php b/src/Forms/DocumentEditType.php index b016ee93..047dc8d6 100644 --- a/src/Forms/DocumentEditType.php +++ b/src/Forms/DocumentEditType.php @@ -17,7 +17,7 @@ use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; -use Symfony\Bundle\SecurityBundle\Security; +use Symfony\Component\Security\Core\Security; use Symfony\Component\Validator\Constraints\File; use Symfony\Component\Validator\Constraints\LessThanOrEqual; use Symfony\Component\Validator\Constraints\NotBlank; diff --git a/src/Forms/DocumentTranslationType.php b/src/Forms/DocumentTranslationType.php index ea1fd10a..946c5821 100644 --- a/src/Forms/DocumentTranslationType.php +++ b/src/Forms/DocumentTranslationType.php @@ -4,8 +4,8 @@ namespace Themes\Rozier\Forms; -use RZ\Roadiz\CoreBundle\Entity\DocumentTranslation; use RZ\Roadiz\CoreBundle\Form\MarkdownType; +use RZ\Roadiz\CoreBundle\Entity\DocumentTranslation; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\Extension\Core\Type\TextType; @@ -29,11 +29,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void 'required' => false, ]) ->add('copyright', TextType::class, [ - 'label' => 'document.copyrightHolder', - 'required' => false, - ]) - ->add('externalUrl', TextType::class, [ - 'label' => 'document.externalUrl', + 'label' => 'copyright', 'required' => false, ]); } diff --git a/src/Forms/NodeSource/NodeSourceCustomFormType.php b/src/Forms/NodeSource/NodeSourceCustomFormType.php index 3b6fa151..b46f3a90 100644 --- a/src/Forms/NodeSource/NodeSourceCustomFormType.php +++ b/src/Forms/NodeSource/NodeSourceCustomFormType.php @@ -85,7 +85,7 @@ public function onPreSetData(FormEvent $event): void $event->setData($this->managerRegistry ->getRepository(CustomForm::class) - ->findByNodeAndFieldName($nodeSource->getNode(), $nodeTypeField->getName())); + ->findByNodeAndField($nodeSource->getNode(), $nodeTypeField)); } /** diff --git a/src/Forms/NodeSource/NodeSourceDocumentType.php b/src/Forms/NodeSource/NodeSourceDocumentType.php index 1e1aeba2..0278872f 100644 --- a/src/Forms/NodeSource/NodeSourceDocumentType.php +++ b/src/Forms/NodeSource/NodeSourceDocumentType.php @@ -88,9 +88,9 @@ public function onPreSetData(FormEvent $event): void $event->setData($this->managerRegistry ->getRepository(Document::class) - ->findByNodeSourceAndFieldName( + ->findByNodeSourceAndField( $nodeSource, - $nodeTypeField->getName() + $nodeTypeField )); } diff --git a/src/Forms/NodeSource/NodeSourceType.php b/src/Forms/NodeSource/NodeSourceType.php index 59d4fbf5..366408a4 100644 --- a/src/Forms/NodeSource/NodeSourceType.php +++ b/src/Forms/NodeSource/NodeSourceType.php @@ -18,7 +18,6 @@ use RZ\Roadiz\CoreBundle\Form\MultipleEnumerationType; use RZ\Roadiz\CoreBundle\Form\YamlType; use RZ\Roadiz\CoreBundle\Security\Authorization\Voter\NodeTypeFieldVoter; -use Symfony\Bundle\SecurityBundle\Security; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\CheckboxType; use Symfony\Component\Form\Extension\Core\Type\CountryType; @@ -32,6 +31,7 @@ use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; +use Symfony\Component\Security\Core\Security; use Symfony\Component\Validator\Constraints\Email; use Symfony\Component\Validator\Constraints\Length; use Symfony\Component\Validator\Constraints\Type; diff --git a/src/Forms/NodeType.php b/src/Forms/NodeType.php index 9cf491af..c85a0b4f 100644 --- a/src/Forms/NodeType.php +++ b/src/Forms/NodeType.php @@ -31,7 +31,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void /** @var Node|null $node */ $node = $builder->getData(); - $isReachable = null !== $node && $node->getNodeType()->isReachable(); + $isReachable = null !== $node && $node->getNodeType()?->isReachable(); if ($isReachable) { $builder->add('home', CheckboxType::class, [ 'label' => 'node.isHome', diff --git a/src/Models/NodeModel.php b/src/Models/NodeModel.php index 1ff17d4d..d7ad14e8 100644 --- a/src/Models/NodeModel.php +++ b/src/Models/NodeModel.php @@ -11,7 +11,7 @@ use RZ\Roadiz\CoreBundle\Entity\Translation; use RZ\Roadiz\CoreBundle\Security\Authorization\Voter\NodeVoter; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; -use Symfony\Bundle\SecurityBundle\Security; +use Symfony\Component\Security\Core\Security; /** * @Serializer\ExclusionPolicy("all") @@ -37,7 +37,7 @@ public function toArray(): array 'nodeName' => $this->node->getNodeName(), 'isPublished' => $this->node->isPublished(), 'nodeType' => [ - 'color' => $this->node->getNodeType()->getColor() ?? '#000000', + 'color' => $this->node->getNodeType()?->getColor() ?? '#000000', ] ]; if ($this->security->isGranted(NodeVoter::EDIT_SETTING, $this->node)) { @@ -60,7 +60,7 @@ public function toArray(): array 'nodeName' => $this->node->getNodeName(), 'isPublished' => $this->node->isPublished(), 'nodeType' => [ - 'color' => $this->node->getNodeType()->getColor() ?? '#000000', + 'color' => $this->node->getNodeType()?->getColor() ?? '#000000', ] ]; diff --git a/src/Models/NodeSourceModel.php b/src/Models/NodeSourceModel.php index c8208a4c..476cc011 100644 --- a/src/Models/NodeSourceModel.php +++ b/src/Models/NodeSourceModel.php @@ -10,7 +10,7 @@ use RZ\Roadiz\CoreBundle\Entity\Translation; use RZ\Roadiz\CoreBundle\Security\Authorization\Voter\NodeVoter; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; -use Symfony\Bundle\SecurityBundle\Security; +use Symfony\Component\Security\Core\Security; /** * @Serializer\ExclusionPolicy("all") @@ -40,7 +40,7 @@ public function toArray(): array 'thumbnail' => $thumbnail ? $thumbnail->getDocument() : null, 'isPublished' => $node->isPublished(), 'nodeType' => [ - 'color' => $node->getNodeType()->getColor() ?? '#000000', + 'color' => $node->getNodeType()?->getColor() ?? '#000000', ] ]; diff --git a/src/Resources/app/less/login/login.less b/src/Resources/app/less/login/login.less index 8802152c..fce6242f 100644 --- a/src/Resources/app/less/login/login.less +++ b/src/Resources/app/less/login/login.less @@ -115,34 +115,38 @@ width: @login-BarW; height: 70px; background-color: var(--accent-color); - top: 0; left: 0; + top: 0px; left: 0; text-align: center; @media (min-width: @screen-sm-min) { height: 116px; } - // Center vertically Default icon when no-image - .uk-icon-rz-roadiz-icon { - display: flex; - align-items: center; - justify-content: center; + &:before { + content: ""; + display: inline-block; height: 100%; - font-size: 40px; + vertical-align: middle; - @media (min-width: @screen-sm-min) { - font-size: 55px; - } } - img, svg, object { - display: block; - height: 100%; - width: 100%; - object-fit: contain; - object-position: center; - margin: 0 auto; - padding: 10px; + .uk-icon-rz-roadiz-icon { + vertical-align: middle; + display: inline-block; + font-size: 55px; + } + + picture, + img, + svg, + object { + position: relative; + max-width: 80%; + height: auto; + max-height: 100px; + vertical-align: middle; + display: inline-block; + width: auto; } } diff --git a/src/Resources/app/less/panels/entries_panel/admin_entries.less b/src/Resources/app/less/panels/entries_panel/admin_entries.less index ec8883ce..2bf65f46 100644 --- a/src/Resources/app/less/panels/entries_panel/admin_entries.less +++ b/src/Resources/app/less/panels/entries_panel/admin_entries.less @@ -154,32 +154,25 @@ &:before, &:after { display: none; } - & > a { - padding: 0; - display: flex; - gap: 10px; - align-items: center; - } i { - font-size: 16px; - width: 16px; + font-size: 20px; + } + & > a { + padding: 5px 10px 5px 7px; } .info { - display: block; - position: relative; - background-color: transparent; - height: auto; - line-height: 1.2em; - left: 0; - padding: 5px 0; - white-space: normal; - font-size: @default-font-size; - color: var(--admin-entries-subnav-text-color); - .box-shadow(0px 0px 0px rgba(0,0,0,0)); + display: inline-block; + background-color: transparent; + height: 43px; + line-height: 43px; + left: 28px; + font-size: @default-font-size; + color: var(--admin-entries-subnav-text-color); + .box-shadow(0px 0px 0px rgba(0,0,0,0)); - &:after { - display: none; - } + &:after { + display: none; + } } &:hover { background-color: #F5F5F5; diff --git a/src/Resources/app/less/panels/user_panel/user_panel.less b/src/Resources/app/less/panels/user_panel/user_panel.less index 9b46f958..8e7a247c 100644 --- a/src/Resources/app/less/panels/user_panel/user_panel.less +++ b/src/Resources/app/less/panels/user_panel/user_panel.less @@ -24,10 +24,6 @@ transition: font-size ease 1s; } - h1, h2, h3, h4, h5, h6 { - padding: 0 10px; - } - &-container{ padding-bottom:0; @@ -38,12 +34,17 @@ .uk-icon-button { text-shadow: 0 1px 0 rgba(0,0,0,.8); - font-size: 12px; - width: 30px; - height: 30px; - line-height: 29px; + font-size: 16px; + line-height: 34px; opacity: 0.3; + @media (min-width: @screen-sm-min) and (max-width: @screen-md-max) { + font-size: 12px; + width: 30px; + height: 30px; + line-height: 29px; + } + &:hover { opacity: 0.8; } @@ -108,6 +109,8 @@ } @media screen and (max-width: @screen-lg-max) { + width:90px; + #cms-version { a { display: block; @@ -122,12 +125,12 @@ } .user-actions { - padding: 15px 10px; + padding: 15px 0px; @media (max-width: @screen-xs-max) { display: block; - position: fixed; - top: 50px; + position:fixed; + top:50px; right:0; bottom:0; width:80%; @@ -151,37 +154,36 @@ .box-sizing(); padding: 0; + &:before { + content:""; + display: inline-block; + vertical-align: middle; + height: 100%; + } + a { - position: relative; font-size: 55px; color: #333333; - display: block; + display: inline-block; text-decoration: none; - padding: 0; - height: 100%; - width: 100%; + opacity: 0.95; + transition: opacity ease 0.5s; + padding-left: 0px; + width: 99%; // on Firefox, prevent line-return + vertical-align: middle; img, svg, object { display: block; - height: 100%; - width: 100%; - object-fit: contain; - object-position: center; + max-width: 95%; + height: auto; + width: auto; + max-height: 110px; margin: 0 auto; - padding: 10px; } &:hover { opacity: 1; } - - // Center vertically Default icon when no-image - &.uk-icon-rz-roadiz-icon:before { - display: flex; - align-items: center; - justify-content: center; - height: 100%; - } } } @@ -199,14 +201,14 @@ } .user-actions { + border-top: 1px solid var(--user-panel-border-color); + @media (min-width: @screen-sm-min) { - margin: 20px 0 0 0; - border-top: 1px solid var(--user-panel-border-color); display: flex; - flex-direction: column; + flex-wrap: wrap; align-items: center; justify-content: center; - gap: 10px; + gap: 5px; } } @@ -216,7 +218,7 @@ } #user-picture { - display: flex; + display: block; width: @user-picture-size; height: @user-picture-size; border-radius: 50%; @@ -239,13 +241,18 @@ padding: 0px; } } - .uk-icon { - color: rgba(255, 255, 255, 0.5); - } &:hover { - text-decoration: none; border: 3px solid #333; } + @media (max-width: @screen-lg-max) { + width:56px; + height:56px; + + img{ + width:56px; + height:56px; + } + } } #cms-version { position: absolute; diff --git a/src/Resources/app/less/responsive/less-768.less b/src/Resources/app/less/responsive/less-768.less index 73c1fc53..1ae98fe7 100644 --- a/src/Resources/app/less/responsive/less-768.less +++ b/src/Resources/app/less/responsive/less-768.less @@ -88,7 +88,7 @@ top:0; right:0; width:60px; - height: @mobile-admin-menu-height; + height:@mobile-admin-menu-height; background: var(--user-panel-color); border-radius: 0; border:0; @@ -98,7 +98,7 @@ background: #3a3a3a; } - img { + img{ position: absolute; width:38px; height:38px; @@ -107,10 +107,6 @@ border-radius: (@user-picture-size / 2)+5px; border: 3px solid var(--user-panel-color); } - - .uk-icon { - color: rgba(255, 255, 255, 0.5); - } } .uk-icon-button{ diff --git a/src/Resources/app/less/vars.less b/src/Resources/app/less/vars.less index 2e690562..2d33951a 100644 --- a/src/Resources/app/less/vars.less +++ b/src/Resources/app/less/vars.less @@ -73,15 +73,14 @@ /* -------- PANEL SIZES -------- */ -@user-panel-width: 90px; +@user-panel-width: 150px; @user-panel-sm-width: 90px; -@user-panel-lg-width: 90px; -@user-panel-xl-width: 90px; +@user-panel-lg-width: 120px; +@user-panel-xl-width: 150px; @entries-panel-width: 60px; @entries-panel-lg-width: 70px; @entries-panel-xl-width: 70px; - @trees-panel-width: 270px; @trees-panel-lg-width: 270px; @trees-panel-xl-width: 350px; @@ -93,8 +92,8 @@ @user-panel-color: #4d4d4d; @user-panel-text-color: #d8d8d8; @user-panel-text-alt-color: #b7b7b7; -@user-picture-size: 56px; -@user-picture-size-mini: 56px; +@user-picture-size: 80px; +@user-picture-size-mini: 70px; @user-panel-border-color: rgba(199,199,204, 0.14); diff --git a/src/Resources/translations/helps.ar.xlf b/src/Resources/translations/helps.ar.xlf index c6900194..5e2f21d6 100644 --- a/src/Resources/translations/helps.ar.xlf +++ b/src/Resources/translations/helps.ar.xlf @@ -17,6 +17,7 @@ + diff --git a/src/Resources/translations/helps.de.xlf b/src/Resources/translations/helps.de.xlf index a8042d4b..602b82aa 100644 --- a/src/Resources/translations/helps.de.xlf +++ b/src/Resources/translations/helps.de.xlf @@ -17,6 +17,7 @@ + diff --git a/src/Resources/translations/helps.en.xlf b/src/Resources/translations/helps.en.xlf index c4c67fea..2e3d338c 100644 --- a/src/Resources/translations/helps.en.xlf +++ b/src/Resources/translations/helps.en.xlf @@ -30,6 +30,10 @@ nodeSource.metaTitle.help SEO title allows you to write the entire title of your page. For optimal display in search engines, the title should not exceed 55 to 65 characters on average. + + nodeSource.metaKeywords.help + + SEO keywords are now optional and are no longer taken into account by search engines. nodeSource.metaDescription.help SEO description is a summary in a few characters of your page. Its purpose is to briefly describe its content. This description must be between 120 and 155 characters long. diff --git a/src/Resources/translations/helps.es.xlf b/src/Resources/translations/helps.es.xlf index 32cd4ae4..cb907e5a 100644 --- a/src/Resources/translations/helps.es.xlf +++ b/src/Resources/translations/helps.es.xlf @@ -17,6 +17,7 @@ + diff --git a/src/Resources/translations/helps.fr.xlf b/src/Resources/translations/helps.fr.xlf index 7c415f21..0022a1be 100644 --- a/src/Resources/translations/helps.fr.xlf +++ b/src/Resources/translations/helps.fr.xlf @@ -30,6 +30,10 @@ nodeSource.metaTitle.help Le titre de référencement permet de rédiger entièrement le titre de votre page. Pour un affichage optimal dans les moteurs de recherche, le titre ne doit pas dépasser 55 à 65 caractères en moyenne. + + nodeSource.metaKeywords.help + + Les mot-clés de référencement sont aujourd’hui facultatifs et ne sont plus pris en compte par les moteurs de recherche. nodeSource.metaDescription.help La description est un résumé de quelques caractères de votre page. Son objectif est de décrire succinctement son contenu. Cette description doit respecter une taille entre 120 et 155 caractères. diff --git a/src/Resources/translations/helps.id.xlf b/src/Resources/translations/helps.id.xlf index bdc35073..c679cebd 100644 --- a/src/Resources/translations/helps.id.xlf +++ b/src/Resources/translations/helps.id.xlf @@ -26,6 +26,10 @@ nodeSource.metaTitle.help Judul SEO memungkinkan Anda untuk menulis seluruh judul halaman Anda. Untuk tampilan optimal di mesin pencari, judulnya tidak boleh melebihi 55 hingga 65 karakter rata-rata. + + nodeSource.metaKeywords.help + + Kata kunci SEO sekarang opsional dan tidak lagi diperhitungkan oleh mesin pencari. nodeSource.metaDescription.help Deskripsi SEO adalah ringkasan dalam beberapa karakter halaman Anda. Tujuannya adalah untuk menggambarkan kontennya secara singkat. Deskripsi ini harus antara 120 dan 155 karakter. diff --git a/src/Resources/translations/helps.it.xlf b/src/Resources/translations/helps.it.xlf index e12bbac7..7f0dde99 100644 --- a/src/Resources/translations/helps.it.xlf +++ b/src/Resources/translations/helps.it.xlf @@ -17,6 +17,7 @@ + diff --git a/src/Resources/translations/helps.ru.xlf b/src/Resources/translations/helps.ru.xlf index c50257a7..0c5be687 100644 --- a/src/Resources/translations/helps.ru.xlf +++ b/src/Resources/translations/helps.ru.xlf @@ -17,6 +17,7 @@ + diff --git a/src/Resources/translations/helps.sr.xlf b/src/Resources/translations/helps.sr.xlf index ed6ba10f..cc2d90b9 100644 --- a/src/Resources/translations/helps.sr.xlf +++ b/src/Resources/translations/helps.sr.xlf @@ -17,6 +17,7 @@ + diff --git a/src/Resources/translations/helps.tr.xlf b/src/Resources/translations/helps.tr.xlf index 2926e610..4bdfb973 100644 --- a/src/Resources/translations/helps.tr.xlf +++ b/src/Resources/translations/helps.tr.xlf @@ -17,6 +17,7 @@ + diff --git a/src/Resources/translations/helps.uk.xlf b/src/Resources/translations/helps.uk.xlf index bb642d67..30359369 100644 --- a/src/Resources/translations/helps.uk.xlf +++ b/src/Resources/translations/helps.uk.xlf @@ -17,6 +17,7 @@ + diff --git a/src/Resources/translations/helps.xlf b/src/Resources/translations/helps.xlf index 9169e138..81d70f20 100644 --- a/src/Resources/translations/helps.xlf +++ b/src/Resources/translations/helps.xlf @@ -29,6 +29,10 @@ nodeSource.metaTitle.help + + + nodeSource.metaKeywords.help + nodeSource.metaDescription.help diff --git a/src/Resources/translations/helps.zh.xlf b/src/Resources/translations/helps.zh.xlf index 740a56dc..d3e921ad 100644 --- a/src/Resources/translations/helps.zh.xlf +++ b/src/Resources/translations/helps.zh.xlf @@ -26,6 +26,10 @@ nodeSource.metaTitle.help SEO 标题能让您写下您页面的全部标题。为了在搜索引擎中完全显示,标题一般不应该超过 55 到 65 个字。 + + nodeSource.metaKeywords.help + + SEO 关键词现在是可选的,且不再被搜索引擎重视。 nodeSource.metaDescription.help SEO 描述是您页面的几个字的总结。它的目的是为了简略的描述它的内容。此描述的长度必须介于 120 到 155 个字之间。 diff --git a/src/Resources/translations/messages.ar.xlf b/src/Resources/translations/messages.ar.xlf index d41e48f9..e490318b 100644 --- a/src/Resources/translations/messages.ar.xlf +++ b/src/Resources/translations/messages.ar.xlf @@ -334,6 +334,10 @@ metaTitle عنوان وصفي + + metaKeywords + الكلمات الدلالية + nodeTypeField.%name%.updated حقل نوع العقدة.%name%.تم تحديثه diff --git a/src/Resources/translations/messages.de.xlf b/src/Resources/translations/messages.de.xlf index 74a59fb8..51dbc09b 100644 --- a/src/Resources/translations/messages.de.xlf +++ b/src/Resources/translations/messages.de.xlf @@ -346,6 +346,10 @@ metaTitle Meta-Titel + + metaKeywords + Meta Stichworte + metaDescription Meta Beschreibung diff --git a/src/Resources/translations/messages.en.xlf b/src/Resources/translations/messages.en.xlf index c4378271..3cffc3f6 100644 --- a/src/Resources/translations/messages.en.xlf +++ b/src/Resources/translations/messages.en.xlf @@ -358,6 +358,10 @@ metaTitle Meta-title + + metaKeywords + Meta-keywords + metaDescription Meta-description @@ -4715,6 +4719,11 @@ Back to working copy Version management : Button label to go back to working copy + + encrypted + Encrypted + Settings : defines if setting value will be encrypted in database. + original.document Original document diff --git a/src/Resources/translations/messages.es.xlf b/src/Resources/translations/messages.es.xlf index 6e4e4669..b5930a1a 100644 --- a/src/Resources/translations/messages.es.xlf +++ b/src/Resources/translations/messages.es.xlf @@ -346,6 +346,10 @@ metaTitle Meta-título + + metaKeywords + Meta-frases clave + metaDescription Meta-descripción @@ -4289,6 +4293,11 @@ Versiones Version management + + encrypted + Encriptado + Settings : defines if setting value will be encrypted in database. + diff --git a/src/Resources/translations/messages.fr.xlf b/src/Resources/translations/messages.fr.xlf index 1142ebc5..326d558b 100644 --- a/src/Resources/translations/messages.fr.xlf +++ b/src/Resources/translations/messages.fr.xlf @@ -358,6 +358,10 @@ metaTitle Titre « méta » + + metaKeywords + Mots-clef « méta » + metaDescription Description « méta » @@ -4715,6 +4719,11 @@ Retour à la version actuelle Version management : Button label to go back to working copy + + encrypted + Chiffré + Settings : defines if setting value will be encrypted in database. + original.document Document original diff --git a/src/Resources/translations/messages.id.xlf b/src/Resources/translations/messages.id.xlf index c7ebff77..9a12b758 100644 --- a/src/Resources/translations/messages.id.xlf +++ b/src/Resources/translations/messages.id.xlf @@ -346,6 +346,10 @@ metaTitle Judul meta + + metaKeywords + Kata kunci meta + metaDescription Deskripsi meta diff --git a/src/Resources/translations/messages.it.xlf b/src/Resources/translations/messages.it.xlf index 9795d348..2e437904 100644 --- a/src/Resources/translations/messages.it.xlf +++ b/src/Resources/translations/messages.it.xlf @@ -334,6 +334,10 @@ metaTitle Meta-titolo + + metaKeywords + Meta-parole chiavi + metaDescription Meta-descrizione diff --git a/src/Resources/translations/messages.ru.xlf b/src/Resources/translations/messages.ru.xlf index 186e4dcf..54c60608 100644 --- a/src/Resources/translations/messages.ru.xlf +++ b/src/Resources/translations/messages.ru.xlf @@ -342,6 +342,10 @@ metaTitle Мета-заголовок + + metaKeywords + Мета-ключевые слова + metaDescription Мета-описание diff --git a/src/Resources/translations/messages.sr.xlf b/src/Resources/translations/messages.sr.xlf index b724eb8c..a31f9528 100644 --- a/src/Resources/translations/messages.sr.xlf +++ b/src/Resources/translations/messages.sr.xlf @@ -342,6 +342,10 @@ metaTitle Meta-наслов + + metaKeywords + Meta-кључне речи + metaDescription Meta-опис diff --git a/src/Resources/translations/messages.tr.xlf b/src/Resources/translations/messages.tr.xlf index caaaf114..674b6e25 100644 --- a/src/Resources/translations/messages.tr.xlf +++ b/src/Resources/translations/messages.tr.xlf @@ -346,6 +346,10 @@ metaTitle Meta başlık + + metaKeywords + Meta anahtar kelimeleri + metaDescription Meta açıklama diff --git a/src/Resources/translations/messages.uk.xlf b/src/Resources/translations/messages.uk.xlf index d77fb216..c0acaee8 100644 --- a/src/Resources/translations/messages.uk.xlf +++ b/src/Resources/translations/messages.uk.xlf @@ -346,6 +346,10 @@ metaTitle Meta-заголовок + + metaKeywords + Ключові слова Meta + metaDescription Meta - опис diff --git a/src/Resources/translations/messages.xlf b/src/Resources/translations/messages.xlf index e2b993d9..32f16c71 100644 --- a/src/Resources/translations/messages.xlf +++ b/src/Resources/translations/messages.xlf @@ -2,7 +2,6 @@ - %namespace%.imported node.%name%.updated node.%name%.was_moved node.%nodeId%.not_exists @@ -92,6 +91,7 @@ source_translation destination_translation metaTitle + metaKeywords metaDescription nodeTypeField.%name%.updated nodeTypeField.%name%.created @@ -1329,6 +1329,7 @@ max_versions_showedVersion management : setting label to choose how many version to display in action-menu versions.back_to_working_copyVersion management : Button label to go back to working copy + encryptedSettings : defines if setting value will be encrypted in database. original.documentDocument : Label to display original document when dealing with thumbnails. see.original.documentDocument : Button Label to display original document when dealing with thumbnails. diff --git a/src/Resources/translations/messages.zh.xlf b/src/Resources/translations/messages.zh.xlf index ae51c187..6f386706 100644 --- a/src/Resources/translations/messages.zh.xlf +++ b/src/Resources/translations/messages.zh.xlf @@ -346,6 +346,10 @@ metaTitle 元-标题 + + metaKeywords + 元-关键词 + metaDescription 元-描述 @@ -4544,6 +4548,11 @@ 回到最新版本 Version management : Button label to go back to working copy + + encrypted + 已加密 + Settings : defines if setting value will be encrypted in database. + original.document 原始文档 diff --git a/src/Resources/views/admin/blocks/adminImage.html.twig b/src/Resources/views/admin/blocks/adminImage.html.twig index 3920352d..b101429b 100644 --- a/src/Resources/views/admin/blocks/adminImage.html.twig +++ b/src/Resources/views/admin/blocks/adminImage.html.twig @@ -1,6 +1,6 @@
{% if themeServices.adminImage %} - {{- themeServices.adminImage|display({ picture: true, width: 180, quality: 70 }) -}} + {{ themeServices.adminImage|display({width:150}) }} {% else %} {% endif %} diff --git a/src/Resources/views/admin/blocks/loginImage.html.twig b/src/Resources/views/admin/blocks/loginImage.html.twig index 44aeb3ca..66c9b743 100644 --- a/src/Resources/views/admin/blocks/loginImage.html.twig +++ b/src/Resources/views/admin/blocks/loginImage.html.twig @@ -1,6 +1,6 @@