diff --git a/.github/workflows/browser-tests.yaml b/.github/workflows/browser-tests.yaml index 4b8b3eb3..e6582bec 100644 --- a/.github/workflows/browser-tests.yaml +++ b/.github/workflows/browser-tests.yaml @@ -13,7 +13,6 @@ jobs: uses: ibexa/gh-workflows/.github/workflows/browser-tests.yml@main with: project-edition: 'oss' - project-version: '^3.3.x-dev' test-suite: '--mode=standard --profile=content-forms --tags=~@broken --non-strict' test-setup-phase-1: '--mode=standard --profile=setup-content-forms' secrets: diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d2fdba1d..11a80ac7 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -42,7 +42,6 @@ jobs: fail-fast: false matrix: php: - - '7.3' - '7.4' - '8.0' - '8.1' diff --git a/.gitignore b/.gitignore index 34526486..724bff30 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /vendor/ composer.lock .php_cs.cache +.php-cs-fixer.cache diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php new file mode 100644 index 00000000..4ba28536 --- /dev/null +++ b/.php-cs-fixer.php @@ -0,0 +1,25 @@ +withRules([ + 'declare_strict_types' => false, +]); + +return $configFactory + ->buildConfig() + ->setFinder( + PhpCsFixer\Finder::create() + ->in([ + __DIR__ . '/src', + __DIR__ . '/tests', + ]) + ->files()->name('*.php') + ); diff --git a/.php_cs b/.php_cs deleted file mode 100644 index 446acea1..00000000 --- a/.php_cs +++ /dev/null @@ -1,14 +0,0 @@ -setFinder( - PhpCsFixer\Finder::create() - ->in(__DIR__ . '/src') - ->exclude([ - 'bin/.travis', - 'doc', - 'vendor', - ]) - ->files()->name('*.php') - ) -; diff --git a/behat_suites.yml b/behat_suites.yml index 3d42b601..8aa10947 100644 --- a/behat_suites.yml +++ b/behat_suites.yml @@ -5,31 +5,31 @@ setup-content-forms: suites: setup: paths: - - vendor/ezsystems/ezplatform-content-forms/features/User/Setup + - vendor/ibexa/content-forms/features/User/Setup contexts: - - EzSystems\EzPlatformContentForms\Behat\Context\UserRegistrationContext - - eZ\Bundle\EzPublishCoreBundle\Features\Context\YamlConfigurationContext + - Ibexa\ContentForms\Behat\Context\UserRegistrationContext + - Ibexa\Bundle\Core\Features\Context\YamlConfigurationContext content-forms: suites: content_edit: paths: - - vendor/ezsystems/ezplatform-content-forms/features/ContentEdit + - vendor/ibexa/content-forms/features/ContentEdit contexts: - - EzSystems\EzPlatformContentForms\Behat\Context\ContentEditContext - - EzSystems\EzPlatformContentForms\Behat\Context\ContentTypeContext - - EzSystems\EzPlatformContentForms\Behat\Context\PagelayoutContext + - Ibexa\ContentForms\Behat\Context\ContentEditContext + - Ibexa\ContentForms\Behat\Context\ContentTypeContext + - Ibexa\ContentForms\Behat\Context\PagelayoutContext fieldtype_form: paths: - - vendor/ezsystems/ezplatform-content-forms/features/FieldTypeForm + - vendor/ibexa/content-forms/features/FieldTypeForm contexts: - - EzSystems\EzPlatformContentForms\Behat\Context\ContentTypeContext - - EzSystems\EzPlatformContentForms\Behat\Context\FieldTypeFormContext - - EzSystems\EzPlatformContentForms\Behat\Context\SelectionFieldTypeFormContext + - Ibexa\ContentForms\Behat\Context\ContentTypeContext + - Ibexa\ContentForms\Behat\Context\FieldTypeFormContext + - Ibexa\ContentForms\Behat\Context\SelectionFieldTypeFormContext user_registration: # @todo move to ezplatform-user paths: - - vendor/ezsystems/ezplatform-content-forms/features/User/Registration + - vendor/ibexa/content-forms/features/User/Registration contexts: - - EzSystems\EzPlatformContentForms\Behat\Context\UserRegistrationContext + - Ibexa\ContentForms\Behat\Context\UserRegistrationContext - Behat\MinkExtension\Context\MinkContext - - eZ\Bundle\EzPublishCoreBundle\Features\Context\YamlConfigurationContext + - Ibexa\Bundle\Core\Features\Context\YamlConfigurationContext diff --git a/bootstrap.php b/bootstrap.php index 92dc3a95..a9fe1d54 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -1,7 +1,7 @@ +
{{ form_start(form) }} {{- form_widget(form.fieldsData) -}} {{ form_end(form) }} diff --git a/features/User/Setup/setup.feature b/features/User/Setup/setup.feature index ff069ecc..ff71f458 100644 --- a/features/User/Setup/setup.feature +++ b/features/User/Setup/setup.feature @@ -7,7 +7,7 @@ Feature: User registration form setup Given a User Group "TestUserGroup" And the following user registration group configuration: """ - ezpublish: + ibexa: system: default: user_registration: diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 43efb7f4..29620047 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -11,10 +11,10 @@ - ./src/lib/Tests/ + ./tests/lib - ./src/bundle/Tests + ./tests/bundle ./tests/ diff --git a/src/bundle/Controller/ContentEditController.php b/src/bundle/Controller/ContentEditController.php index 709ed5f7..155d38bb 100644 --- a/src/bundle/Controller/ContentEditController.php +++ b/src/bundle/Controller/ContentEditController.php @@ -1,35 +1,35 @@ $this->generateUrl('ezplatform.content.draft.create'), + 'action' => $this->generateUrl('ibexa.content.draft.create'), ] ); @@ -124,11 +124,11 @@ public function createContentDraftAction( } /** - * @param \EzSystems\EzPlatformContentForms\Content\View\ContentEditView $view + * @param \Ibexa\ContentForms\Content\View\ContentEditView $view * - * @return \EzSystems\EzPlatformContentForms\Content\View\ContentEditView + * @return \Ibexa\ContentForms\Content\View\ContentEditView * - * @throws \eZ\Publish\API\Repository\Exceptions\BadStateException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException */ public function editVersionDraftAction(ContentEditView $view): ContentEditView { @@ -136,14 +136,16 @@ public function editVersionDraftAction(ContentEditView $view): ContentEditView } /** - * @param \EzSystems\EzPlatformContentForms\Content\View\ContentEditSuccessView $view + * @param \Ibexa\ContentForms\Content\View\ContentEditSuccessView $view * - * @return \EzSystems\EzPlatformContentForms\Content\View\ContentEditSuccessView + * @return \Ibexa\ContentForms\Content\View\ContentEditSuccessView * - * @throws \eZ\Publish\API\Repository\Exceptions\BadStateException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException */ public function editVersionDraftSuccessAction(ContentEditSuccessView $view): ContentEditSuccessView { return $view; } } + +class_alias(ContentEditController::class, 'EzSystems\EzPlatformContentFormsBundle\Controller\ContentEditController'); diff --git a/src/bundle/Controller/UserController.php b/src/bundle/Controller/UserController.php index d3f806d2..1f94138e 100644 --- a/src/bundle/Controller/UserController.php +++ b/src/bundle/Controller/UserController.php @@ -1,63 +1,53 @@ $form->createView(), 'language' => $language, 'parent_location' => $location, @@ -154,15 +145,15 @@ public function createAction( * @param int $contentId ContentType id to create * @param int $versionNo Version number the version should be created from. Defaults to the currently published one. * @param string $language Language code to create the version in (eng-GB, ger-DE, ...)) - * @param Request $request + * @param \Symfony\Component\HttpFoundation\Request $request * - * @return Response|UserUpdateView + * @return \Symfony\Component\HttpFoundation\Response|\Ibexa\ContentForms\User\View\UserUpdateView * - * @throws \eZ\Publish\API\Repository\Exceptions\BadStateException - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException - * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException - * @throws \eZ\Publish\Core\Base\Exceptions\InvalidArgumentType - * @throws \eZ\Publish\Core\Base\Exceptions\UnauthorizedException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws \Ibexa\Core\Base\Exceptions\InvalidArgumentType + * @throws \Ibexa\Core\Base\Exceptions\UnauthorizedException */ public function editAction( int $contentId, @@ -182,10 +173,25 @@ public function editAction( $userUpdate = (new UserUpdateMapper())->mapToFormData($user, $contentType, [ 'languageCode' => $language, ]); + + try { + // assume main location if no location was provided + $location = $this->locationService->loadLocation( + (int)$user->versionInfo->contentInfo->mainLocationId + ); + } catch (UnauthorizedException $e) { + // if no access to the main location assume content has multiple locations and first of them can be used + $availableLocations = $this->locationService->loadLocations( + $user->versionInfo->contentInfo + ); + $location = array_shift($availableLocations); + } + $form = $this->createForm( UserUpdateType::class, $userUpdate, [ + 'location' => $location, 'languageCode' => $language, 'mainLanguageCode' => $user->contentInfo->mainLanguageCode, ] @@ -199,19 +205,6 @@ public function editAction( } } - try { - // assume main location if no location was provided - $location = $this->locationService->loadLocation( - (int)$user->versionInfo->contentInfo->mainLocationId - ); - } catch (UnauthorizedException $e) { - // if no access to the main location assume content has multiple locations and first of them can be used - $availableLocations = $this->locationService->loadLocations( - $user->versionInfo->contentInfo - ); - $location = array_shift($availableLocations); - } - $parentLocation = null; try { $parentLocation = $this->locationService->loadLocation($location->parentLocationId); @@ -219,7 +212,8 @@ public function editAction( } return new UserUpdateView( - null, [ + null, + [ 'form' => $form->createView(), 'language_code' => $language, 'language' => $this->languageService->loadLanguage($language), @@ -234,3 +228,5 @@ public function editAction( ); } } + +class_alias(UserController::class, 'EzSystems\EzPlatformContentFormsBundle\Controller\UserController'); diff --git a/src/bundle/Controller/UserRegisterController.php b/src/bundle/Controller/UserRegisterController.php index 35425573..e77617fc 100644 --- a/src/bundle/Controller/UserRegisterController.php +++ b/src/bundle/Controller/UserRegisterController.php @@ -1,27 +1,27 @@ userRegisterController->registerConfirmAction(); } } + +class_alias(UserRegisterController::class, 'EzSystems\EzPlatformContentFormsBundle\Controller\UserRegisterController'); diff --git a/src/bundle/DependencyInjection/Compiler/FieldTypeFormMapperDispatcherPass.php b/src/bundle/DependencyInjection/Compiler/FieldTypeFormMapperDispatcherPass.php index b2a5f8a5..bd46d7f9 100644 --- a/src/bundle/DependencyInjection/Compiler/FieldTypeFormMapperDispatcherPass.php +++ b/src/bundle/DependencyInjection/Compiler/FieldTypeFormMapperDispatcherPass.php @@ -1,13 +1,14 @@ findDefinition(self::FIELD_TYPE_FORM_MAPPER_DISPATCHER); - foreach ($this->findTaggedFormMapperServices($container) as $id => $tags) { + $taggedServiceIds = $container->findTaggedServiceIds( + self::FIELD_TYPE_FORM_MAPPER_VALUE_SERVICE_TAG + ); + foreach ($taggedServiceIds as $serviceId => $tags) { foreach ($tags as $tag) { if (!isset($tag['fieldType'])) { throw new LogicException( - '`ezplatform.field_type.form_mapper` or deprecated `ez.fieldFormMapper` service tags need a "fieldType" attribute to identify which Field Type the mapper is for.' + sprintf( + 'Service "%s" tagged with "%s" service tag needs a "fieldType" ' . + 'attribute to identify which Field Type the mapper is for.', + $serviceId, + self::FIELD_TYPE_FORM_MAPPER_VALUE_SERVICE_TAG + ) ); } - $dispatcherDefinition->addMethodCall('addMapper', [new Reference($id), $tag['fieldType']]); + $dispatcherDefinition->addMethodCall('addMapper', [new Reference($serviceId), $tag['fieldType']]); } } } - - /** - * Gathers services tagged as either - * - ez.fieldFormMapper.value (deprecated) - * - ez.fieldFormMapper.definition (deprecated) - * - ezplatform.field_type.form_mapper.value - * - ezplatform.field_type.form_mapper.definition. - * - * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container - * - * @return array - */ - private function findTaggedFormMapperServices(ContainerBuilder $container): array - { - $deprecatedFieldFormMapperValueTags = $container->findTaggedServiceIds(self::DEPRECATED_FIELD_TYPE_FORM_MAPPER_VALUE_SERVICE_TAG); - $fieldFormMapperValueTags = $container->findTaggedServiceIds(self::FIELD_TYPE_FORM_MAPPER_VALUE_SERVICE_TAG); - - foreach ($deprecatedFieldFormMapperValueTags as $ezFieldFormMapperValueTag) { - @trigger_error( - sprintf( - 'The `%s` service tag is deprecated and will be removed in eZ Platform 4.0. Use `%s` instead.', - self::DEPRECATED_FIELD_TYPE_FORM_MAPPER_VALUE_SERVICE_TAG, - self::FIELD_TYPE_FORM_MAPPER_VALUE_SERVICE_TAG - ), - E_USER_DEPRECATED - ); - } - - return array_merge( - $deprecatedFieldFormMapperValueTags, - $fieldFormMapperValueTags - ); - } } + +class_alias(FieldTypeFormMapperDispatcherPass::class, 'EzSystems\EzPlatformContentFormsBundle\DependencyInjection\Compiler\FieldTypeFormMapperDispatcherPass'); diff --git a/src/bundle/DependencyInjection/Configuration/Parser/ContentCreateView.php b/src/bundle/DependencyInjection/Configuration/Parser/ContentCreateView.php index eed8ce4c..293d17b5 100644 --- a/src/bundle/DependencyInjection/Configuration/Parser/ContentCreateView.php +++ b/src/bundle/DependencyInjection/Configuration/Parser/ContentCreateView.php @@ -1,17 +1,19 @@ prependExtensionConfig('jms_translation', [ 'configs' => [ - 'ezplatform_content_forms' => [ + 'ibexa_content_forms' => [ 'dirs' => [ __DIR__ . '/../../../src/', ], @@ -49,7 +49,9 @@ private function prependJMSTranslation(ContainerBuilder $container): void private function shouldLoadTestServices(ContainerBuilder $container): bool { - return $container->hasParameter('ibexa.testing.browser.enabled') - && true === $container->getParameter('ibexa.testing.browser.enabled'); + return $container->hasParameter('ibexa.behat.browser.enabled') + && true === $container->getParameter('ibexa.behat.browser.enabled'); } } + +class_alias(IbexaContentFormsExtension::class, 'EzSystems\EzPlatformContentFormsBundle\DependencyInjection\EzPlatformContentFormsExtension'); diff --git a/src/bundle/EzPlatformContentFormsBundle.php b/src/bundle/IbexaContentFormsBundle.php similarity index 51% rename from src/bundle/EzPlatformContentFormsBundle.php rename to src/bundle/IbexaContentFormsBundle.php index 6dca7b19..70b6b33b 100644 --- a/src/bundle/EzPlatformContentFormsBundle.php +++ b/src/bundle/IbexaContentFormsBundle.php @@ -1,29 +1,29 @@ addCompilerPass(new FieldTypeFormMapperDispatcherPass()); - $eZExtension = $container->getExtension('ezpublish'); + $eZExtension = $container->getExtension('ibexa'); $eZExtension->addConfigParser(new ContentEdit()); $eZExtension->addConfigParser(new UserEdit()); $eZExtension->addConfigParser(new ContentEditView()); @@ -31,3 +31,5 @@ public function build(ContainerBuilder $container) $eZExtension->addDefaultSettings(__DIR__ . '/Resources/config', ['ezpublish_default_settings.yaml']); } } + +class_alias(IbexaContentFormsBundle::class, 'EzSystems\EzPlatformContentFormsBundle\EzPlatformContentFormsBundle'); diff --git a/src/bundle/Resources/config/ezpublish_default_settings.yaml b/src/bundle/Resources/config/ezpublish_default_settings.yaml index 52e33def..02d27754 100644 --- a/src/bundle/Resources/config/ezpublish_default_settings.yaml +++ b/src/bundle/Resources/config/ezpublish_default_settings.yaml @@ -1,10 +1,10 @@ parameters: - ezsettings.default.content_edit.templates.edit: '@@EzPlatformContentForms/Content/content_edit.html.twig' - ezsettings.default.content_edit.templates.create: '@@EzPlatformContentForms/Content/content_edit.html.twig' - ezsettings.default.content_edit.templates.create_draft: '@@EzPlatformContentForms/Content/content_create_draft.html.twig' + ibexa.site_access.config.default.content_edit.templates.edit: '@@IbexaContentForms/Content/content_edit.html.twig' + ibexa.site_access.config.default.content_edit.templates.create: '@@IbexaContentForms/Content/content_edit.html.twig' + ibexa.site_access.config.default.content_edit.templates.create_draft: '@@IbexaContentForms/Content/content_create_draft.html.twig' - ezsettings.default.user_edit.templates.update: '@@EzPlatformContentForms/Content/content_edit.html.twig' - ezsettings.default.user_edit.templates.create: '@@EzPlatformContentForms/Content/content_edit.html.twig' + ibexa.site_access.config.default.user_edit.templates.update: '@@IbexaContentForms/Content/content_edit.html.twig' + ibexa.site_access.config.default.user_edit.templates.create: '@@IbexaContentForms/Content/content_edit.html.twig' - ezsettings.default.content_edit_view: {} - ezsettings.default.content_create_view: {} + ibexa.site_access.config.default.content_edit_view: {} + ibexa.site_access.config.default.content_create_view: {} diff --git a/src/bundle/Resources/config/feature_contexts.yaml b/src/bundle/Resources/config/feature_contexts.yaml index 1727d569..4f8e688c 100644 --- a/src/bundle/Resources/config/feature_contexts.yaml +++ b/src/bundle/Resources/config/feature_contexts.yaml @@ -4,18 +4,18 @@ services: autoconfigure: true public: true - EzSystems\EzPlatformContentForms\Behat\Context\ContentTypeContext: + Ibexa\ContentForms\Behat\Context\ContentTypeContext: arguments: - $permissionResolver: '@=service("ezpublish.api.repository").getPermissionResolver()' - $contentTypeService: '@ezpublish.api.service.content_type' + $permissionResolver: '@Ibexa\Contracts\Core\Repository\PermissionResolver' + $contentTypeService: '@ibexa.api.service.content_type' - EzSystems\EzPlatformContentForms\Behat\Context\PagelayoutContext: + Ibexa\ContentForms\Behat\Context\PagelayoutContext: arguments: - $configResolver: '@ezpublish.config.resolver' + $configResolver: '@ibexa.config.resolver' - EzSystems\EzPlatformContentForms\Behat\Context\UserRegistrationContext: + Ibexa\ContentForms\Behat\Context\UserRegistrationContext: arguments: - $permissionResolver: '@=service("ezpublish.api.repository").getPermissionResolver()' - $roleService: '@ezpublish.api.service.role' - $userService: '@ezpublish.api.service.user' - $contentTypeService: '@ezpublish.api.service.content_type' + $permissionResolver: '@Ibexa\Contracts\Core\Repository\PermissionResolver' + $roleService: '@ibexa.api.service.role' + $userService: '@ibexa.api.service.user' + $contentTypeService: '@ibexa.api.service.content_type' diff --git a/src/bundle/Resources/config/fieldtypes.yaml b/src/bundle/Resources/config/fieldtypes.yaml index 2d086f6d..ae7d335c 100644 --- a/src/bundle/Resources/config/fieldtypes.yaml +++ b/src/bundle/Resources/config/fieldtypes.yaml @@ -4,135 +4,135 @@ services: autoconfigure: true public: false - eZ\Publish\API\Repository\FieldTypeService: '@ezpublish.api.service.field_type' + Ibexa\Contracts\Core\Repository\FieldTypeService: '@ibexa.api.service.field_type' # # FieldTypes # - EzSystems\EzPlatformContentForms\Form\Type\FieldType\: + Ibexa\ContentForms\Form\Type\FieldType\: resource: '../../../lib/Form/Type/FieldType/*' tags: - { name: 'form.type' } - EzSystems\EzPlatformContentForms\Form\Type\FieldType\CountryFieldType: + Ibexa\ContentForms\Form\Type\FieldType\CountryFieldType: arguments: - $countriesInfo: '%ezpublish.fieldType.ezcountry.data%' + $countriesInfo: '%ibexa.field_type.country.data%' # # FormMappers # - EzSystems\EzPlatformContentForms\FieldType\Mapper\AuthorFormMapper: + Ibexa\ContentForms\FieldType\Mapper\AuthorFormMapper: tags: - - { name: ezplatform.field_type.form_mapper.value, fieldType: ezauthor } + - { name: ibexa.admin_ui.field_type.form.mapper.value, fieldType: ezauthor } - EzSystems\EzPlatformContentForms\FieldType\Mapper\BinaryFileFormMapper: + Ibexa\ContentForms\FieldType\Mapper\BinaryFileFormMapper: tags: - - { name: ezplatform.field_type.form_mapper.value, fieldType: ezbinaryfile } + - { name: ibexa.admin_ui.field_type.form.mapper.value, fieldType: ezbinaryfile } - EzSystems\EzPlatformContentForms\FieldType\Mapper\CheckboxFormMapper: + Ibexa\ContentForms\FieldType\Mapper\CheckboxFormMapper: tags: - - { name: ezplatform.field_type.form_mapper.value, fieldType: ezboolean } + - { name: ibexa.admin_ui.field_type.form.mapper.value, fieldType: ezboolean } - EzSystems\EzPlatformContentForms\FieldType\Mapper\SelectionFormMapper: + Ibexa\ContentForms\FieldType\Mapper\SelectionFormMapper: tags: - - { name: ezplatform.field_type.form_mapper.value, fieldType: ezselection } + - { name: ibexa.admin_ui.field_type.form.mapper.value, fieldType: ezselection } - EzSystems\EzPlatformContentForms\FieldType\Mapper\CountryFormMapper: + Ibexa\ContentForms\FieldType\Mapper\CountryFormMapper: tags: - - { name: ezplatform.field_type.form_mapper.value, fieldType: ezcountry } + - { name: ibexa.admin_ui.field_type.form.mapper.value, fieldType: ezcountry } - EzSystems\EzPlatformContentForms\FieldType\Mapper\DateFormMapper: + Ibexa\ContentForms\FieldType\Mapper\DateFormMapper: tags: - - { name: ezplatform.field_type.form_mapper.value, fieldType: ezdate } + - { name: ibexa.admin_ui.field_type.form.mapper.value, fieldType: ezdate } - EzSystems\EzPlatformContentForms\FieldType\Mapper\DateTimeFormMapper: + Ibexa\ContentForms\FieldType\Mapper\DateTimeFormMapper: tags: - - { name: ezplatform.field_type.form_mapper.value, fieldType: ezdatetime } + - { name: ibexa.admin_ui.field_type.form.mapper.value, fieldType: ezdatetime } - EzSystems\EzPlatformContentForms\FieldType\Mapper\FloatFormMapper: + Ibexa\ContentForms\FieldType\Mapper\FloatFormMapper: tags: - - { name: ezplatform.field_type.form_mapper.value, fieldType: ezfloat } + - { name: ibexa.admin_ui.field_type.form.mapper.value, fieldType: ezfloat } - EzSystems\EzPlatformContentForms\FieldType\Mapper\ImageFormMapper: + Ibexa\ContentForms\FieldType\Mapper\ImageFormMapper: tags: - - { name: ezplatform.field_type.form_mapper.value, fieldType: ezimage } + - { name: ibexa.admin_ui.field_type.form.mapper.value, fieldType: ezimage } - EzSystems\EzPlatformContentForms\FieldType\Mapper\IntegerFormMapper: + Ibexa\ContentForms\FieldType\Mapper\IntegerFormMapper: tags: - - { name: ezplatform.field_type.form_mapper.value, fieldType: ezinteger } + - { name: ibexa.admin_ui.field_type.form.mapper.value, fieldType: ezinteger } - EzSystems\EzPlatformContentForms\FieldType\Mapper\ISBNFormMapper: + Ibexa\ContentForms\FieldType\Mapper\ISBNFormMapper: tags: - - { name: ezplatform.field_type.form_mapper.value, fieldType: ezisbn } + - { name: ibexa.admin_ui.field_type.form.mapper.value, fieldType: ezisbn } - EzSystems\EzPlatformContentForms\FieldType\Mapper\MediaFormMapper: + Ibexa\ContentForms\FieldType\Mapper\MediaFormMapper: tags: - - { name: ezplatform.field_type.form_mapper.value, fieldType: ezmedia } + - { name: ibexa.admin_ui.field_type.form.mapper.value, fieldType: ezmedia } - EzSystems\EzPlatformContentForms\FieldType\Mapper\AbstractRelationFormMapper: + Ibexa\ContentForms\FieldType\Mapper\AbstractRelationFormMapper: abstract: true arguments: - $contentTypeService: '@ezpublish.api.service.content_type' + $contentTypeService: '@ibexa.api.service.content_type' - EzSystems\EzPlatformContentForms\FieldType\Mapper\RelationFormMapper: - parent: EzSystems\EzPlatformContentForms\FieldType\Mapper\AbstractRelationFormMapper + Ibexa\ContentForms\FieldType\Mapper\RelationFormMapper: + parent: Ibexa\ContentForms\FieldType\Mapper\AbstractRelationFormMapper autowire: true autoconfigure: false public: false tags: - - { name: ezplatform.field_type.form_mapper.value, fieldType: ezobjectrelation } + - { name: ibexa.admin_ui.field_type.form.mapper.value, fieldType: ezobjectrelation } - EzSystems\EzPlatformContentForms\FieldType\Mapper\RelationListFormMapper: - parent: EzSystems\EzPlatformContentForms\FieldType\Mapper\AbstractRelationFormMapper + Ibexa\ContentForms\FieldType\Mapper\RelationListFormMapper: + parent: Ibexa\ContentForms\FieldType\Mapper\AbstractRelationFormMapper autowire: true autoconfigure: false public: false tags: - - { name: ezplatform.field_type.form_mapper.value, fieldType: ezobjectrelationlist } + - { name: ibexa.admin_ui.field_type.form.mapper.value, fieldType: ezobjectrelationlist } - EzSystems\EzPlatformContentForms\FieldType\Mapper\TextLineFormMapper: + Ibexa\ContentForms\FieldType\Mapper\TextLineFormMapper: tags: - - { name: ezplatform.field_type.form_mapper.value, fieldType: ezstring } + - { name: ibexa.admin_ui.field_type.form.mapper.value, fieldType: ezstring } - EzSystems\EzPlatformContentForms\FieldType\Mapper\TextBlockFormMapper: + Ibexa\ContentForms\FieldType\Mapper\TextBlockFormMapper: tags: - - { name: ezplatform.field_type.form_mapper.value, fieldType: eztext } + - { name: ibexa.admin_ui.field_type.form.mapper.value, fieldType: eztext } - EzSystems\EzPlatformContentForms\FieldType\Mapper\TimeFormMapper: + Ibexa\ContentForms\FieldType\Mapper\TimeFormMapper: tags: - - { name: ezplatform.field_type.form_mapper.value, fieldType: eztime } + - { name: ibexa.admin_ui.field_type.form.mapper.value, fieldType: eztime } - EzSystems\EzPlatformContentForms\FieldType\Mapper\FormTypeBasedFieldValueFormMapper: + Ibexa\ContentForms\FieldType\Mapper\FormTypeBasedFieldValueFormMapper: abstract: true - EzSystems\EzPlatformContentForms\FieldType\Mapper\UserAccountFieldValueFormMapper: + Ibexa\ContentForms\FieldType\Mapper\UserAccountFieldValueFormMapper: tags: - - { name: ezplatform.field_type.form_mapper.value, fieldType: ezuser } + - { name: ibexa.admin_ui.field_type.form.mapper.value, fieldType: ezuser } - EzSystems\EzPlatformContentForms\FieldType\Mapper\UrlFormMapper: + Ibexa\ContentForms\FieldType\Mapper\UrlFormMapper: tags: - - { name: ezplatform.field_type.form_mapper.value, fieldType: ezurl } + - { name: ibexa.admin_ui.field_type.form.mapper.value, fieldType: ezurl } - EzSystems\EzPlatformContentForms\FieldType\Mapper\MapLocationFormMapper: + Ibexa\ContentForms\FieldType\Mapper\MapLocationFormMapper: tags: - - { name: ezplatform.field_type.form_mapper.value, fieldType: ezgmaplocation } + - { name: ibexa.admin_ui.field_type.form.mapper.value, fieldType: ezgmaplocation } - EzSystems\EzPlatformContentForms\FieldType\Mapper\KeywordFormMapper: + Ibexa\ContentForms\FieldType\Mapper\KeywordFormMapper: tags: - - { name: ezplatform.field_type.form_mapper.value, fieldType: ezkeyword } + - { name: ibexa.admin_ui.field_type.form.mapper.value, fieldType: ezkeyword } - ezplatform.content_forms.field_type.form_mapper.ezemail: - parent: EzSystems\EzPlatformContentForms\FieldType\Mapper\FormTypeBasedFieldValueFormMapper + ibexa.content_forms.field_type.form_mapper.ezemail: + parent: Ibexa\ContentForms\FieldType\Mapper\FormTypeBasedFieldValueFormMapper autowire: true autoconfigure: false public: false tags: - - { name: ezplatform.field_type.form_mapper.value, fieldType: ezemail } + - { name: ibexa.admin_ui.field_type.form.mapper.value, fieldType: ezemail } calls: - [setFormType, ['Symfony\Component\Form\Extension\Core\Type\EmailType']] - EzSystems\EzPlatformContentForms\FieldType\Mapper\ImageAssetFormMapper: + Ibexa\ContentForms\FieldType\Mapper\ImageAssetFormMapper: tags: - - { name: ezplatform.field_type.form_mapper.value, fieldType: ezimageasset } + - { name: ibexa.admin_ui.field_type.form.mapper.value, fieldType: ezimageasset } diff --git a/src/bundle/Resources/config/form_types.yaml b/src/bundle/Resources/config/form_types.yaml index 5687c618..f16ef48c 100644 --- a/src/bundle/Resources/config/form_types.yaml +++ b/src/bundle/Resources/config/form_types.yaml @@ -4,10 +4,12 @@ services: autoconfigure: true public: false - EzSystems\EzPlatformContentForms\Form\Type\SwitcherType: ~ + Ibexa\ContentForms\Form\Type\SwitcherType: ~ - EzSystems\EzPlatformContentForms\Form\Type\FieldType\BinaryBaseFieldType: ~ + Ibexa\ContentForms\Form\Type\FieldType\BinaryBaseFieldType: ~ - EzSystems\EzPlatformContentForms\Form\Type\LocationType: ~ + Ibexa\ContentForms\Form\Type\LocationType: ~ - EzSystems\EzPlatformContentForms\Form\Type\Content\FieldCollectionType: ~ + Ibexa\ContentForms\Form\Type\RelationType: ~ + + Ibexa\ContentForms\Form\Type\Content\FieldCollectionType: ~ diff --git a/src/bundle/Resources/config/routing.yaml b/src/bundle/Resources/config/routing.yaml index e67584f1..2143cdf9 100644 --- a/src/bundle/Resources/config/routing.yaml +++ b/src/bundle/Resources/config/routing.yaml @@ -1,39 +1,39 @@ -ezplatform.content.create_no_draft: +ibexa.content.create_no_draft: path: /content/create/nodraft/{contentTypeIdentifier}/{language}/{parentLocationId} defaults: - _controller: ez_content_edit:createWithoutDraftAction + _controller: ibexa_content_edit:createWithoutDraftAction options: expose: true # @todo rename language to languageCode in 3.0 -ezplatform.content.draft.edit: +ibexa.content.draft.edit: path: /content/edit/draft/{contentId}/{versionNo}/{language}/{locationId} defaults: - _controller: ez_content_edit:editVersionDraftAction + _controller: ibexa_content_edit:editVersionDraftAction language: ~ # @todo rename to languageCode in 3.0 locationId: ~ options: expose: true -ezplatform.content.draft.create: +ibexa.content.draft.create: path: /content/create/draft/{contentId}/{fromVersionNo}/{fromLanguage} defaults: - _controller: ez_content_edit:createContentDraftAction + _controller: ibexa_content_edit:createContentDraftAction contentId: ~ fromVersionNo: ~ fromLanguage: ~ options: expose: true -ezplatform.user.create: +ibexa.user.create: path: /user/create/{contentTypeIdentifier}/{language}/{parentLocationId} defaults: - _controller: "ezplatform.content_forms.controller.user:createAction" + _controller: Ibexa\Bundle\ContentForms\Controller\UserController:createAction -ezplatform.user.update: +ibexa.user.update: path: /user/update/{contentId}/{versionNo}/{language} defaults: - _controller: "ezplatform.content_forms.controller.user:editAction" + _controller: Ibexa\Bundle\ContentForms\Controller\UserController:editAction options: expose: true diff --git a/src/bundle/Resources/config/services.yaml b/src/bundle/Resources/config/services.yaml index cc4f9824..eed59f8b 100644 --- a/src/bundle/Resources/config/services.yaml +++ b/src/bundle/Resources/config/services.yaml @@ -4,157 +4,128 @@ imports: - {resource: views.yaml} parameters: - ezplatform.content_forms.field_type_form_mapper.dispatcher.class: EzSystems\EzPlatformContentForms\FieldType\FieldTypeFormMapperDispatcher - ezplatform.content_forms.field.form_type.class: EzSystems\EzPlatformContentForms\Form\Type\Content\ContentFieldType - ezplatform.content_forms.validator.field_value.class: EzSystems\EzPlatformContentForms\Validator\Constraints\FieldValueValidator - - ezplatform.content_forms.action_dispatcher.base.class: EzSystems\EzPlatformContentForms\Form\ActionDispatcher\AbstractActionDispatcher - ezplatform.content_forms.action_dispatcher.content.class: EzSystems\EzPlatformContentForms\Form\ActionDispatcher\ContentDispatcher - ezplatform.content_forms.action_dispatcher.user.class: EzSystems\EzPlatformContentForms\Form\ActionDispatcher\UserDispatcher - ezplatform.content_forms.form_processor.content.class: EzSystems\EzPlatformContentForms\Form\Processor\ContentFormProcessor - ezplatform.content_forms.form_processor.user_create.class: EzSystems\EzPlatformContentForms\Form\Processor\User\UserCreateFormProcessor - ezplatform.content_forms.form_processor.user_update.class: EzSystems\EzPlatformContentForms\Form\Processor\User\UserUpdateFormProcessor - ezplatform.content_forms.form_processor.user_cancel.class: EzSystems\EzPlatformContentForms\Form\Processor\User\UserCancelFormProcessor - - ezplatform.content_forms.controller.content_edit.class: EzSystems\EzPlatformContentFormsBundle\Controller\ContentEditController - ezplatform.content_forms.controller.user_register.class: EzSystems\EzPlatformContentFormsBundle\Controller\UserRegisterController - ezplatform.content_forms.controller.user.class: EzSystems\EzPlatformContentFormsBundle\Controller\UserController - - ezplatform.content_forms.view_templates_listener.class: EzSystems\EzPlatformContentForms\EventListener\ViewTemplatesListener - - ezplatform.content_forms.user_content_type_identifier: "user" + ibexa.content_forms.user_content_type_identifier: "user" services: - ezplatform.content_forms.field_type_form_mapper.dispatcher: - class: "%ezplatform.content_forms.field_type_form_mapper.dispatcher.class%" + Ibexa\ContentForms\FieldType\FieldTypeFormMapperDispatcher: ~ - ezplatform.content_forms.field.form_type: - class: "%ezplatform.content_forms.field.form_type.class%" - arguments: ["@ezplatform.content_forms.field_type_form_mapper.dispatcher"] + Ibexa\ContentForms\Form\Type\Content\ContentFieldType: + arguments: ['@Ibexa\ContentForms\FieldType\FieldTypeFormMapperDispatcher'] tags: - { name: form.type, alias: ezplatform_content_forms_content_field } # Validators - ezplatform.content_forms.validator.field_type.abstract: - class: EzSystems\EzPlatformContentForms\Validator\Constraints\FieldTypeValidator - arguments: ["@ezpublish.api.service.field_type"] + Ibexa\AdminUi\Validator\Constraints\FieldTypeValidator: + class: Ibexa\ContentForms\Validator\Constraints\FieldTypeValidator + arguments: ['@ibexa.api.service.field_type'] abstract: true - EzSystems\EzPlatformContentForms\Validator\Constraints\PasswordValidator: + Ibexa\ContentForms\Validator\Constraints\PasswordValidator: arguments: - $userService: '@ezpublish.api.service.user' + $userService: '@ibexa.api.service.user' tags: - { name: validator.constraint_validator } - EzSystems\EzPlatformContentForms\Validator\Constraints\UserAccountPasswordValidator: + Ibexa\ContentForms\Validator\Constraints\UserAccountPasswordValidator: arguments: - $userService: '@ezpublish.api.service.user' + $userService: '@ibexa.api.service.user' tags: - { name: validator.constraint_validator } - ezplatform.content_forms.validator.field_value: - parent: ezplatform.content_forms.validator.field_type.abstract - class: "%ezplatform.content_forms.validator.field_value.class%" + Ibexa\ContentForms\Validator\Constraints\FieldValueValidator: + parent: Ibexa\AdminUi\Validator\Constraints\FieldTypeValidator + class: Ibexa\ContentForms\Validator\Constraints\FieldValueValidator tags: - { name: validator.constraint_validator, alias: ezplatform.content_forms.validator.field_value } # Action dispatchers - ezplatform.content_forms.action_dispatcher.base: - class: "%ezplatform.content_forms.action_dispatcher.base.class%" + Ibexa\ContentForms\Form\ActionDispatcher\AbstractActionDispatcher: abstract: true calls: - [setEventDispatcher, ["@event_dispatcher"]] - ezplatform.content_forms.action_dispatcher.content: - class: "%ezplatform.content_forms.action_dispatcher.content.class%" - parent: ezplatform.content_forms.action_dispatcher.base + Ibexa\ContentForms\Form\ActionDispatcher\ContentDispatcher: + parent: Ibexa\ContentForms\Form\ActionDispatcher\AbstractActionDispatcher - ezplatform.content_forms.action_dispatcher.user: - class: "%ezplatform.content_forms.action_dispatcher.user.class%" - parent: ezplatform.content_forms.action_dispatcher.base + Ibexa\ContentForms\Form\ActionDispatcher\UserDispatcher: + parent: Ibexa\ContentForms\Form\ActionDispatcher\AbstractActionDispatcher # Form processors - ezplatform.content_forms.form_processor.content: - class: '%ezplatform.content_forms.form_processor.content.class%' + Ibexa\ContentForms\Form\Processor\ContentFormProcessor: arguments: - - '@ezpublish.api.service.content' - - '@ezpublish.api.service.location' + - '@ibexa.api.service.content' + - '@ibexa.api.service.location' - '@router' tags: - { name: kernel.event_subscriber } - ezplatform.content_forms.form_processor.user_create: - class: "%ezplatform.content_forms.form_processor.user_create.class%" + Ibexa\ContentForms\Form\Processor\User\UserCreateFormProcessor: arguments: - - '@ezpublish.api.service.user' + - '@ibexa.api.service.user' - '@router' tags: - { name: kernel.event_subscriber } - ezplatform.content_forms.form_processor.user_update: - class: "%ezplatform.content_forms.form_processor.user_update.class%" + Ibexa\ContentForms\Form\Processor\User\UserUpdateFormProcessor: arguments: - - '@ezpublish.api.service.user' - - '@ezpublish.api.service.content' + - '@ibexa.api.service.user' + - '@ibexa.api.service.content' - '@router' tags: - { name: kernel.event_subscriber } - ezplatform.content_forms.form_processor.user: - class: "%ezplatform.content_forms.form_processor.user_cancel.class%" + Ibexa\ContentForms\Form\Processor\User\UserCancelFormProcessor: arguments: - '@router' tags: - { name: kernel.event_subscriber } - EzSystems\EzPlatformContentForms\Form\Processor\SystemUrlRedirectProcessor: + Ibexa\ContentForms\Form\Processor\SystemUrlRedirectProcessor: autowire: true autoconfigure: true # Controllers - ezplatform.content_forms.controller.content_edit: + Ibexa\Bundle\ContentForms\Controller\ContentEditController: public: true - class: "%ezplatform.content_forms.controller.content_edit.class%" + class: Ibexa\Bundle\ContentForms\Controller\ContentEditController arguments: - - "@ezpublish.api.service.content_type" - - "@ezpublish.api.service.content" - - "@ezplatform.content_forms.action_dispatcher.content" - parent: ezpublish.controller.base + - '@ibexa.api.service.content_type' + - '@ibexa.api.service.content' + - '@Ibexa\ContentForms\Form\ActionDispatcher\ContentDispatcher' + parent: Ibexa\Core\MVC\Symfony\Controller\Controller tags: - { name: controller.service_arguments } - ezplatform.content_forms.controller.user: - class: "%ezplatform.content_forms.controller.user.class%" + Ibexa\Bundle\ContentForms\Controller\UserController: arguments: - - "@ezpublish.api.service.content_type" - - "@ezpublish.api.service.user" - - "@ezpublish.api.service.location" - - "@ezpublish.api.service.language" - - "@ezplatform.content_forms.action_dispatcher.user" - - '@eZ\Publish\API\Repository\PermissionResolver' - - '@eZ\Publish\Core\MVC\Symfony\Locale\UserLanguagePreferenceProvider' + - '@ibexa.api.service.content_type' + - '@ibexa.api.service.user' + - '@ibexa.api.service.location' + - '@ibexa.api.service.language' + - '@Ibexa\ContentForms\Form\ActionDispatcher\UserDispatcher' + - '@Ibexa\Contracts\Core\Repository\PermissionResolver' + - '@Ibexa\Core\MVC\Symfony\Locale\UserLanguagePreferenceProvider' - '@Ibexa\ContentForms\Content\Form\Provider\GroupedContentFormFieldsProvider' - parent: ezpublish.controller.base + parent: Ibexa\Core\MVC\Symfony\Controller\Controller tags: - { name: controller.service_arguments } - ez_content_edit: - alias: ezplatform.content_forms.controller.content_edit + ibexa_content_edit: + alias: Ibexa\Bundle\ContentForms\Controller\ContentEditController public: true - ezplatform.content_forms.view_templates_listener: - class: "%ezplatform.content_forms.view_templates_listener.class%" + Ibexa\ContentForms\EventListener\ViewTemplatesListener: arguments: - $configResolver: '@ezpublish.config.resolver' + $configResolver: '@ibexa.config.resolver' tags: - { name: kernel.event_subscriber } - EzSystems\EzPlatformContentForms\ConfigResolver\MaxUploadSize: ~ + Ibexa\ContentForms\ConfigResolver\MaxUploadSize: ~ Ibexa\Contracts\ContentForms\Content\Form\Provider\GroupedContentFormFieldsProviderInterface: '@Ibexa\ContentForms\Content\Form\Provider\GroupedContentFormFieldsProvider' Ibexa\ContentForms\Content\Form\Provider\GroupedContentFormFieldsProvider: arguments: - $fieldsGroupsList: '@ezpublish.fields_groups.list' + $fieldsGroupsList: '@Ibexa\Core\Helper\FieldsGroups\FieldsGroupsList' diff --git a/src/bundle/Resources/config/validation.yaml b/src/bundle/Resources/config/validation.yaml index 949c7058..b3544cf4 100644 --- a/src/bundle/Resources/config/validation.yaml +++ b/src/bundle/Resources/config/validation.yaml @@ -1,14 +1,14 @@ -EzSystems\EzPlatformContentForms\Data\Content\ContentCreateData: +Ibexa\ContentForms\Data\Content\ContentCreateData: properties: fieldsData: - Valid: ~ -EzSystems\EzPlatformContentForms\Data\Content\ContentUpdateData: +Ibexa\ContentForms\Data\Content\ContentUpdateData: properties: fieldsData: - Valid: ~ -EzSystems\EzPlatformContentForms\Data\User\UserCreateData: +Ibexa\ContentForms\Data\User\UserCreateData: properties: login: - NotBlank: ~ @@ -19,17 +19,17 @@ EzSystems\EzPlatformContentForms\Data\User\UserCreateData: fieldsData: - Valid: ~ -EzSystems\EzPlatformContentForms\Data\User\UserUpdateData: +Ibexa\ContentForms\Data\User\UserUpdateData: properties: fieldsData: - Valid: ~ -EzSystems\EzPlatformContentForms\Data\User\UserAccountFieldData: +Ibexa\ContentForms\Data\User\UserAccountFieldData: properties: username: - Valid: ~ - NotBlank: ~ -EzSystems\EzPlatformContentForms\Data\Content\FieldData: +Ibexa\Contracts\ContentForms\Data\Content\FieldData: constraints: - - EzSystems\EzPlatformContentForms\Validator\Constraints\FieldValue: ~ + - Ibexa\ContentForms\Validator\Constraints\FieldValue: ~ diff --git a/src/bundle/Resources/config/views.yaml b/src/bundle/Resources/config/views.yaml index 047b3f18..feca734e 100644 --- a/src/bundle/Resources/config/views.yaml +++ b/src/bundle/Resources/config/views.yaml @@ -5,77 +5,78 @@ services: autoconfigure: true # ContentEditView - EzSystems\EzPlatformContentForms\Content\View\Builder\ContentEditViewBuilder: + Ibexa\ContentForms\Content\View\Builder\ContentEditViewBuilder: arguments: - - '@ezpublish.api.repository' - - '@ezpublish.view.configurator' - - '@ezpublish.view.view_parameters.injector.dispatcher' - - '@ezplatform.content_forms.action_dispatcher.content' + - '@ibexa.api.repository' + - '@Ibexa\Core\MVC\Symfony\View\Configurator\ViewProvider' + - '@Ibexa\Core\MVC\Symfony\View\ParametersInjector\EventDispatcherInjector' + - '@Ibexa\ContentForms\Form\ActionDispatcher\ContentDispatcher' tags: - - { name: ibexa.view_builder } + - { name: ibexa.view.builder } - EzSystems\EzPlatformContentForms\Content\View\Provider\ContentEditView\Configured: + Ibexa\ContentForms\Content\View\Provider\ContentEditView\Configured: arguments: - - '@ezplatform.repository_forms.content_edit_view.matcher_factory' + - '@ibexa.content_forms.content_edit_view.matcher_factory' tags: - - { name: ezpublish.view_provider, type: EzSystems\EzPlatformContentForms\Content\View\ContentEditView, priority: 10 } + - { name: ibexa.view.provider, type: Ibexa\ContentForms\Content\View\ContentEditView, priority: 10 } - ezplatform.repository_forms.content_edit_view.matcher_factory: - class: '%ezpublish.view.matcher_factory.class%' + ibexa.content_forms.content_edit_view.matcher_factory: + class: Ibexa\Bundle\Core\Matcher\ServiceAwareMatcherFactory arguments: - - '@eZ\Bundle\EzPublishCoreBundle\Matcher\ViewMatcherRegistry' - - '@ezpublish.api.repository' - - 'eZ\Publish\Core\MVC\Symfony\Matcher\ContentBased' + - '@Ibexa\Bundle\Core\Matcher\ViewMatcherRegistry' + - '@ibexa.api.repository' + - 'Ibexa\Core\MVC\Symfony\Matcher\ContentBased' - ezplatform.repository_forms.content_edit_view.matcher_factory.dynamically_configured: - class: eZ\Publish\Core\MVC\Symfony\Matcher\DynamicallyConfiguredMatcherFactoryDecorator - decorates: ezplatform.repository_forms.content_edit_view.matcher_factory + ibexa.content_forms.content_edit_view.matcher_factory.dynamically_configured: + class: Ibexa\Core\MVC\Symfony\Matcher\DynamicallyConfiguredMatcherFactoryDecorator + decorates: ibexa.content_forms.content_edit_view.matcher_factory arguments: - $innerConfigurableMatcherFactory: '@ezplatform.repository_forms.content_edit_view.matcher_factory.dynamically_configured.inner' - $configResolver: '@ezpublish.config.resolver' + $innerConfigurableMatcherFactory: '@ibexa.content_forms.content_edit_view.matcher_factory.dynamically_configured.inner' + $configResolver: '@ibexa.config.resolver' $parameterName: content_edit_view - EzSystems\EzPlatformContentForms\Content\View\Filter\ContentEditViewFilter: + Ibexa\ContentForms\Content\View\Filter\ContentEditViewFilter: arguments: - - '@ezpublish.api.service.content' - - '@ezpublish.api.service.content_type' + - '@ibexa.api.service.content' + - '@ibexa.api.service.location' + - '@ibexa.api.service.content_type' tags: - { name: kernel.event_subscriber } # ContentCreateView - EzSystems\EzPlatformContentForms\Content\View\Builder\ContentCreateViewBuilder: + Ibexa\ContentForms\Content\View\Builder\ContentCreateViewBuilder: arguments: - - '@ezpublish.api.repository' - - '@ezpublish.view.configurator' - - '@ezpublish.view.view_parameters.injector.dispatcher' - - '@ezplatform.content_forms.action_dispatcher.content' + - '@ibexa.api.repository' + - '@Ibexa\Core\MVC\Symfony\View\Configurator\ViewProvider' + - '@Ibexa\Core\MVC\Symfony\View\ParametersInjector\EventDispatcherInjector' + - '@Ibexa\ContentForms\Form\ActionDispatcher\ContentDispatcher' tags: - - { name: ibexa.view_builder } + - { name: ibexa.view.builder } - EzSystems\EzPlatformContentForms\Content\View\Provider\ContentCreateView\Configured: + Ibexa\ContentForms\Content\View\Provider\ContentCreateView\Configured: arguments: - - '@ezplatform.repository_forms.content_create_view.matcher_factory' + - '@ibexa.content_forms.content_create_view.matcher_factory' tags: - - {name: ezpublish.view_provider, type: 'EzSystems\EzPlatformContentForms\Content\View\ContentCreateView', priority: 10} + - {name: ibexa.view.provider, type: 'Ibexa\ContentForms\Content\View\ContentCreateView', priority: 10} - ezplatform.repository_forms.content_create_view.matcher_factory: - class: '%ezpublish.view.matcher_factory.class%' + ibexa.content_forms.content_create_view.matcher_factory: + class: Ibexa\Bundle\Core\Matcher\ServiceAwareMatcherFactory arguments: - - '@eZ\Bundle\EzPublishCoreBundle\Matcher\ViewMatcherRegistry' - - '@ezpublish.api.repository' - - 'eZ\Publish\Core\MVC\Symfony\Matcher\ContentBased' + - '@Ibexa\Bundle\Core\Matcher\ViewMatcherRegistry' + - '@ibexa.api.repository' + - 'Ibexa\Core\MVC\Symfony\Matcher\ContentBased' - ezplatform.repository_forms.content_create_view.matcher_factory.dynamically_configured: - class: eZ\Publish\Core\MVC\Symfony\Matcher\DynamicallyConfiguredMatcherFactoryDecorator - decorates: ezplatform.repository_forms.content_create_view.matcher_factory + ibexa.content_forms.content_create_view.matcher_factory.dynamically_configured: + class: Ibexa\Core\MVC\Symfony\Matcher\DynamicallyConfiguredMatcherFactoryDecorator + decorates: ibexa.content_forms.content_create_view.matcher_factory arguments: - $innerConfigurableMatcherFactory: '@ezplatform.repository_forms.content_create_view.matcher_factory.dynamically_configured.inner' - $configResolver: '@ezpublish.config.resolver' + $innerConfigurableMatcherFactory: '@ibexa.content_forms.content_create_view.matcher_factory.dynamically_configured.inner' + $configResolver: '@ibexa.config.resolver' $parameterName: content_create_view - EzSystems\EzPlatformContentForms\Content\View\Filter\ContentCreateViewFilter: + Ibexa\ContentForms\Content\View\Filter\ContentCreateViewFilter: arguments: - - '@ezpublish.api.service.location' - - '@ezpublish.api.service.content_type' + - '@ibexa.api.service.location' + - '@ibexa.api.service.content_type' tags: - { name: kernel.event_subscriber } diff --git a/src/bundle/Resources/translations/ibexa_content_forms_fieldtype.en.xliff b/src/bundle/Resources/translations/ibexa_content_forms_fieldtype.en.xliff new file mode 100644 index 00000000..ad72a6e0 --- /dev/null +++ b/src/bundle/Resources/translations/ibexa_content_forms_fieldtype.en.xliff @@ -0,0 +1,31 @@ + + + +
+ + The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message. +
+ + + Select Starting Location + Select Starting Location + key: content_forms.relation.location_type + + + Browse + Browse + key: content_forms.relation.location_type.browse + + + Default + Default + key: content_forms.relation.location_type.default + + + Content location + Content location + key: content_forms.relation.location_type.self + + +
+
diff --git a/src/bundle/Resources/translations/validators.en.xliff b/src/bundle/Resources/translations/validators.en.xliff index abe17f1c..054e33d4 100644 --- a/src/bundle/Resources/translations/validators.en.xliff +++ b/src/bundle/Resources/translations/validators.en.xliff @@ -21,6 +21,11 @@ User login '%login%' already in use. Enter a unique login. key: User login '%login%' already in use. Enter a unique login. + + Passwords do not match. + Passwords do not match. + key: content.field_type.passwords_must_match + diff --git a/src/bundle/Resources/views/Content/content_edit.html.twig b/src/bundle/Resources/views/Content/content_edit.html.twig index 015ee175..66c94aa1 100644 --- a/src/bundle/Resources/views/Content/content_edit.html.twig +++ b/src/bundle/Resources/views/Content/content_edit.html.twig @@ -1,7 +1,7 @@ {% extends no_layout is defined and no_layout == true ? view_base_layout : page_layout %} {% block content %} -
+
{{ form_start(form) }} {% for child in form.fieldsData %} {{- form_widget(child) -}} diff --git a/src/bundle/Resources/views/content_name/content_name.html.twig b/src/bundle/Resources/views/content_name/content_name.html.twig index b8f18ad7..b975110e 100644 --- a/src/bundle/Resources/views/content_name/content_name.html.twig +++ b/src/bundle/Resources/views/content_name/content_name.html.twig @@ -1,4 +1,4 @@ {% extends view_base_layout %} {% block content %} -{{ ez_content_name( content ) }} +{{ ibexa_content_name( content ) }} {% endblock %} diff --git a/src/contracts/Content/Form/Provider/GroupedContentFormFieldsProviderInterface.php b/src/contracts/Content/Form/Provider/GroupedContentFormFieldsProviderInterface.php index f212ab3b..19f016bd 100644 --- a/src/contracts/Content/Form/Provider/GroupedContentFormFieldsProviderInterface.php +++ b/src/contracts/Content/Form/Provider/GroupedContentFormFieldsProviderInterface.php @@ -1,7 +1,7 @@ fieldDefinition->fieldTypeIdentifier; + } +} + +class_alias( + FieldData::class, + \EzSystems\RepositoryForms\Data\Content\FieldData::class +); + +class_alias(FieldData::class, 'EzSystems\EzPlatformContentForms\Data\Content\FieldData'); diff --git a/src/lib/FieldType/FieldValueFormMapperInterface.php b/src/contracts/FieldType/FieldValueFormMapperInterface.php similarity index 53% rename from src/lib/FieldType/FieldValueFormMapperInterface.php rename to src/contracts/FieldType/FieldValueFormMapperInterface.php index 65f338ad..ae5ed3be 100644 --- a/src/lib/FieldType/FieldValueFormMapperInterface.php +++ b/src/contracts/FieldType/FieldValueFormMapperInterface.php @@ -1,14 +1,14 @@ getEnvironment(); - $this->contentTypeContext = $environment->getContext('EzSystems\EzPlatformContentForms\Behat\Context\ContentTypeContext'); + $this->contentTypeContext = $environment->getContext(ContentTypeContext::class); } /** @@ -193,3 +193,5 @@ public function aContentCreationFormIsDisplayed() $this->visit('/content/create/nodraft/folder/eng-GB/2'); } } + +class_alias(ContentEditContext::class, 'EzSystems\EzPlatformContentForms\Behat\Context\ContentEditContext'); diff --git a/src/lib/Behat/Context/ContentTypeContext.php b/src/lib/Behat/Context/ContentTypeContext.php index bee0b763..97e452fa 100644 --- a/src/lib/Behat/Context/ContentTypeContext.php +++ b/src/lib/Behat/Context/ContentTypeContext.php @@ -1,38 +1,38 @@ 'ezselection', ]; - /** @var \EzSystems\EzPlatformContentForms\Behat\Context\ContentTypeContext */ + /** @var \Ibexa\ContentForms\Behat\Context\ContentTypeContext */ private $contentTypeContext; /** @BeforeScenario */ public function gatherContexts(BeforeScenarioScope $scope) { $environment = $scope->getEnvironment(); - $this->contentTypeContext = $environment->getContext('EzSystems\EzPlatformContentForms\Behat\Context\ContentTypeContext'); + $this->contentTypeContext = $environment->getContext(ContentTypeContext::class); } /** @@ -238,3 +238,5 @@ private function getRequiredFieldTypeExceptions(string $fieldTypeIdentifier): ar return []; } } + +class_alias(FieldTypeFormContext::class, 'EzSystems\EzPlatformContentForms\Behat\Context\FieldTypeFormContext'); diff --git a/src/lib/Behat/Context/PagelayoutContext.php b/src/lib/Behat/Context/PagelayoutContext.php index 71f593c1..6f056a7e 100644 --- a/src/lib/Behat/Context/PagelayoutContext.php +++ b/src/lib/Behat/Context/PagelayoutContext.php @@ -1,26 +1,26 @@ '; + public const TWIG_DEBUG_STOP_REGEX = ''; /** - * @var ConfigResolverInterface + * @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ private $configResolver; @@ -55,3 +55,5 @@ public function getPageLayout(): string : $this->configResolver->getParameter('pagelayout', null, 'site'); } } + +class_alias(PagelayoutContext::class, 'EzSystems\EzPlatformContentForms\Behat\Context\PagelayoutContext'); diff --git a/src/lib/Behat/Context/SelectionFieldTypeFormContext.php b/src/lib/Behat/Context/SelectionFieldTypeFormContext.php index 3f567bd4..9bbf1953 100644 --- a/src/lib/Behat/Context/SelectionFieldTypeFormContext.php +++ b/src/lib/Behat/Context/SelectionFieldTypeFormContext.php @@ -1,12 +1,12 @@ fieldTypeFormContext = $scope->getEnvironment()->getContext( - 'EzSystems\EzPlatformContentForms\Behat\Context\FieldTypeFormContext' - ); + $this->fieldTypeFormContext = $scope->getEnvironment()->getContext(FieldTypeFormContext::class); } /** @@ -113,3 +111,5 @@ public function theInputIsAMultipleSelectionDropdown() $this->assertSession()->elementExists('css', $selector); } } + +class_alias(SelectionFieldTypeFormContext::class, 'EzSystems\EzPlatformContentForms\Behat\Context\SelectionFieldTypeFormContext'); diff --git a/src/lib/Behat/Context/UserRegistrationContext.php b/src/lib/Behat/Context/UserRegistrationContext.php index 557747d9..c914e68f 100644 --- a/src/lib/Behat/Context/UserRegistrationContext.php +++ b/src/lib/Behat/Context/UserRegistrationContext.php @@ -1,28 +1,27 @@ '; + public const TWIG_DEBUG_STOP_REGEX = ''; private static $password = 'PassWord42'; @@ -47,12 +46,12 @@ class UserRegistrationContext extends RawMinkContext implements Context, Snippet /** * Used to cover registration group customization. * - * @var UserGroup + * @var \Ibexa\Contracts\Core\Repository\Values\User\UserGroup */ private $customUserGroup; /** - * @var YamlConfigurationContext + * @var \Ibexa\Bundle\Core\Features\Context\YamlConfigurationContext */ private $yamlConfigurationContext; @@ -61,16 +60,16 @@ class UserRegistrationContext extends RawMinkContext implements Context, Snippet */ private $adminUserId = 14; - /** @var \eZ\Publish\API\Repository\PermissionResolver */ + /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ private $permissionResolver; - /** @var \eZ\Publish\API\Repository\RoleService */ + /** @var \Ibexa\Contracts\Core\Repository\RoleService */ private $roleService; - /** @var \eZ\Publish\API\Repository\UserService */ + /** @var \Ibexa\Contracts\Core\Repository\UserService */ private $userService; - /** @var \eZ\Publish\API\Repository\ContentTypeService */ + /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ private $contentTypeService; public function __construct( @@ -89,9 +88,7 @@ public function __construct( /** @BeforeScenario */ public function gatherContexts(BeforeScenarioScope $scope) { - $this->yamlConfigurationContext = $scope->getEnvironment()->getContext( - 'eZ\Bundle\EzPublishCoreBundle\Features\Context\YamlConfigurationContext' - ); + $this->yamlConfigurationContext = $scope->getEnvironment()->getContext(YamlConfigurationContext::class); } /** @@ -117,9 +114,9 @@ public function loginAsUserWithUserRegisterPolicy() /** * Creates a user for registration testing, and assigns it the role $role. * - * @param Role $role + * @param \Ibexa\Contracts\Core\Repository\Values\User\Role $role * - * @return User + * @return \Ibexa\Contracts\Core\Repository\Values\User\User */ private function createUserWithRole(Role $role) { @@ -146,7 +143,7 @@ private function createUserWithRole(Role $role) * * @param bool $withUserRegisterPolicy Determines if the role gets the user/register policy * - * @return Role + * @return \Ibexa\Contracts\Core\Repository\Values\User\Role */ private function createRegistrationRole($withUserRegisterPolicy = true) { @@ -183,7 +180,7 @@ public function iSeeAnErrorMessageSayingThatICanNotRegister() } /** - * @param User $user + * @param \Ibexa\Contracts\Core\Repository\Values\User\User $user * * @throws \Behat\Mink\Exception\ElementNotFoundException */ @@ -391,3 +388,5 @@ public function thePageIsRenderedUsingTheTemplateConfiguredIn($template) ); } } + +class_alias(UserRegistrationContext::class, 'EzSystems\EzPlatformContentForms\Behat\Context\UserRegistrationContext'); diff --git a/src/lib/ConfigResolver/MaxUploadSize.php b/src/lib/ConfigResolver/MaxUploadSize.php index fec27240..1c93e29a 100644 --- a/src/lib/ConfigResolver/MaxUploadSize.php +++ b/src/lib/ConfigResolver/MaxUploadSize.php @@ -1,19 +1,19 @@ getViewData(); $fieldGroupIdentifier = $this->fieldsGroupsList->getFieldGroup($fieldData->fieldDefinition); $fieldGroupName = $fieldsGroups[$fieldGroupIdentifier] ?? $this->fieldsGroupsList->getDefaultGroup(); diff --git a/src/lib/Content/View/Builder/AbstractContentViewBuilder.php b/src/lib/Content/View/Builder/AbstractContentViewBuilder.php index a859d291..3439e42e 100644 --- a/src/lib/Content/View/Builder/AbstractContentViewBuilder.php +++ b/src/lib/Content/View/Builder/AbstractContentViewBuilder.php @@ -1,52 +1,52 @@ isSubmitted()) { $validationErrors = $this->contentService->validate( - $content->getVersionInfo(), [ + $content->getVersionInfo(), + [ 'content' => $content, ] ); @@ -141,10 +142,10 @@ public function buildView(array $parameters) * @param array $languages * @param int|null $versionNo * - * @return \eZ\Publish\API\Repository\Values\Content\Content + * @return \Ibexa\Contracts\Core\Repository\Values\Content\Content * - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException - * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException */ private function loadContent(int $contentId, array $languages = [], int $versionNo = null): Content { @@ -157,9 +158,9 @@ private function loadContent(int $contentId, array $languages = [], int $version * @param int $contentTypeId * @param string[] $languageCodes * - * @return \eZ\Publish\API\Repository\Values\ContentType\ContentType + * @return \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType * - * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException */ private function loadContentType(int $contentTypeId, array $languageCodes): ContentType { @@ -168,12 +169,12 @@ private function loadContentType(int $contentTypeId, array $languageCodes): Cont /** * @param array $parameters - * @param \eZ\Publish\API\Repository\Values\Content\Location|null $location - * @param \eZ\Publish\API\Repository\Values\Content\Language $language + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location|null $location + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Language $language * - * @return \eZ\Publish\API\Repository\Values\Content\Content + * @return \Ibexa\Contracts\Core\Repository\Values\Content\Content * - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException */ private function resolveContent(array $parameters, ?Location $location, Language $language): Content { @@ -202,7 +203,7 @@ private function resolveContent(array $parameters, ?Location $location, Language /** * @param array $parameters * - * @return \eZ\Publish\API\Repository\Values\Content\Location|null + * @return \Ibexa\Contracts\Core\Repository\Values\Content\Location|null */ private function resolveLocation(array $parameters): ?Location { @@ -222,3 +223,5 @@ private function resolveLocation(array $parameters): ?Location return null; } } + +class_alias(ContentEditViewBuilder::class, 'EzSystems\EzPlatformContentForms\Content\View\Builder\ContentEditViewBuilder'); diff --git a/src/lib/Content/View/ContentCreateDraftView.php b/src/lib/Content/View/ContentCreateDraftView.php index dc2002f3..f2910167 100644 --- a/src/lib/Content/View/ContentCreateDraftView.php +++ b/src/lib/Content/View/ContentCreateDraftView.php @@ -1,16 +1,18 @@ setResponse($response); - $this->setControllerReference(new ControllerReference('ez_content_edit:createWithoutDraftSuccessAction')); + $this->setControllerReference(new ControllerReference('ibexa_content_edit:createWithoutDraftSuccessAction')); } /** - * @param \eZ\Publish\API\Repository\Values\Content\Location|null $location + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location|null $location */ public function setLocation(?Location $location): void { @@ -41,10 +41,12 @@ public function setLocation(?Location $location): void } /** - * @return \eZ\Publish\API\Repository\Values\Content\Location|null + * @return \Ibexa\Contracts\Core\Repository\Values\Content\Location|null */ public function getLocation(): ?Location { return $this->location; } } + +class_alias(ContentCreateSuccessView::class, 'EzSystems\EzPlatformContentForms\Content\View\ContentCreateSuccessView'); diff --git a/src/lib/Content/View/ContentCreateView.php b/src/lib/Content/View/ContentCreateView.php index 1eb82cfb..a3a5b53d 100644 --- a/src/lib/Content/View/ContentCreateView.php +++ b/src/lib/Content/View/ContentCreateView.php @@ -1,36 +1,36 @@ form = $form; } } + +class_alias(ContentCreateView::class, 'EzSystems\EzPlatformContentForms\Content\View\ContentCreateView'); diff --git a/src/lib/Content/View/ContentEditSuccessView.php b/src/lib/Content/View/ContentEditSuccessView.php index 142a90e6..81fb544a 100644 --- a/src/lib/Content/View/ContentEditSuccessView.php +++ b/src/lib/Content/View/ContentEditSuccessView.php @@ -1,39 +1,39 @@ setResponse($response); - $this->setControllerReference(new ControllerReference('ez_content_edit:editVersionDraftSuccessAction')); + $this->setControllerReference(new ControllerReference('ibexa_content_edit:editVersionDraftSuccessAction')); } /** - * @param \eZ\Publish\API\Repository\Values\Content\Location|null $location + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location|null $location */ public function setLocation(?Location $location): void { @@ -41,10 +41,12 @@ public function setLocation(?Location $location): void } /** - * @return \eZ\Publish\API\Repository\Values\Content\Location|null + * @return \Ibexa\Contracts\Core\Repository\Values\Content\Location|null */ public function getLocation(): ?Location { return $this->location; } } + +class_alias(ContentEditSuccessView::class, 'EzSystems\EzPlatformContentForms\Content\View\ContentEditSuccessView'); diff --git a/src/lib/Content/View/ContentEditView.php b/src/lib/Content/View/ContentEditView.php index 5bb819d5..0611c295 100644 --- a/src/lib/Content/View/ContentEditView.php +++ b/src/lib/Content/View/ContentEditView.php @@ -1,37 +1,37 @@ form = $form; } } + +class_alias(ContentEditView::class, 'EzSystems\EzPlatformContentForms\Content\View\ContentEditView'); diff --git a/src/lib/Content/View/ContentTypeValueView.php b/src/lib/Content/View/ContentTypeValueView.php index c72e74ad..e105e875 100644 --- a/src/lib/Content/View/ContentTypeValueView.php +++ b/src/lib/Content/View/ContentTypeValueView.php @@ -1,14 +1,14 @@ getParameters()->get('_controller')) { + if ('ibexa_content_edit:createWithoutDraftAction' !== $event->getParameters()->get('_controller')) { return; } @@ -94,11 +94,11 @@ public function handleContentCreateForm(FilterViewBuilderParametersEvent $event) } /** - * @param \eZ\Publish\API\Repository\Values\ContentType\ContentType $contentType - * @param \eZ\Publish\API\Repository\Values\Content\Location $location + * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType $contentType + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $location * @param string $languageCode * - * @return \EzSystems\EzPlatformContentForms\Data\Content\ContentCreateData + * @return \Ibexa\ContentForms\Data\Content\ContentCreateData */ private function resolveContentCreateData( ContentType $contentType, @@ -117,7 +117,7 @@ private function resolveContentCreateData( } /** - * @param \EzSystems\EzPlatformContentForms\Data\Content\ContentCreateData $contentCreateData + * @param \Ibexa\ContentForms\Data\Content\ContentCreateData $contentCreateData * @param string $languageCode * * @return \Symfony\Component\Form\FormInterface @@ -136,3 +136,5 @@ private function resolveContentCreateForm( ]); } } + +class_alias(ContentCreateViewFilter::class, 'EzSystems\EzPlatformContentForms\Content\View\Filter\ContentCreateViewFilter'); diff --git a/src/lib/Content/View/Filter/ContentEditViewFilter.php b/src/lib/Content/View/Filter/ContentEditViewFilter.php index b191c7d2..ab009b0a 100644 --- a/src/lib/Content/View/Filter/ContentEditViewFilter.php +++ b/src/lib/Content/View/Filter/ContentEditViewFilter.php @@ -1,49 +1,55 @@ contentTypeService = $contentTypeService; $this->formFactory = $formFactory; $this->languagePreferenceProvider = $languagePreferenceProvider; + $this->locationService = $locationService; } public static function getSubscribedEvents() @@ -60,15 +67,15 @@ public static function getSubscribedEvents() } /** - * @param \eZ\Publish\Core\MVC\Symfony\View\Event\FilterViewBuilderParametersEvent $event + * @param \Ibexa\Core\MVC\Symfony\View\Event\FilterViewBuilderParametersEvent $event * * @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException - * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException */ public function handleContentEditForm(FilterViewBuilderParametersEvent $event) { - if ('ez_content_edit:editVersionDraftAction' !== $event->getParameters()->get('_controller')) { + if ('ibexa_content_edit:editVersionDraftAction' !== $event->getParameters()->get('_controller')) { return; } @@ -88,16 +95,27 @@ public function handleContentEditForm(FilterViewBuilderParametersEvent $event) $this->languagePreferenceProvider->getPreferredLanguages() ); + try { + $location = $this->locationService->loadLocation( + (int)$event->getParameters()->get( + 'locationId', + $contentDraft->contentInfo->mainLocationId + ) + ); + } catch (NotFoundException $e) { + } + $contentUpdate = $this->resolveContentEditData( $contentDraft, $languageCode, $contentType, - $currentFields, + $currentFields ); $form = $this->resolveContentEditForm( $contentUpdate, $languageCode, - $contentDraft + $contentDraft, + $location ?? null ); $event->getParameters()->add([ @@ -107,7 +125,7 @@ public function handleContentEditForm(FilterViewBuilderParametersEvent $event) } /** - * @param array<\eZ\Publish\API\Repository\Values\Content\Field> $currentFields + * @param array<\Ibexa\Contracts\Core\Repository\Values\Content\Field> $currentFields */ private function resolveContentEditData( Content $content, @@ -125,21 +143,23 @@ private function resolveContentEditData( } /** - * @param \EzSystems\EzPlatformContentForms\Data\Content\ContentUpdateData $contentUpdate + * @param \Ibexa\ContentForms\Data\Content\ContentUpdateData $contentUpdate * @param string $languageCode - * @param \eZ\Publish\API\Repository\Values\Content\Content $content + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content $content * * @return \Symfony\Component\Form\FormInterface */ private function resolveContentEditForm( ContentUpdateData $contentUpdate, string $languageCode, - Content $content + Content $content, + ?Location $location = null ): FormInterface { return $this->formFactory->create( ContentEditType::class, $contentUpdate, [ + 'location' => $location, 'languageCode' => $languageCode, 'mainLanguageCode' => $content->contentInfo->mainLanguageCode, 'content' => $content, @@ -149,3 +169,5 @@ private function resolveContentEditForm( ); } } + +class_alias(ContentEditViewFilter::class, 'EzSystems\EzPlatformContentForms\Content\View\Filter\ContentEditViewFilter'); diff --git a/src/lib/Content/View/Provider/ContentCreateView/Configured.php b/src/lib/Content/View/Provider/ContentCreateView/Configured.php index e74674b6..3907ceb6 100644 --- a/src/lib/Content/View/Provider/ContentCreateView/Configured.php +++ b/src/lib/Content/View/Provider/ContentCreateView/Configured.php @@ -1,17 +1,17 @@ locationStructs[] = $locationStruct; } } + +class_alias(ContentCreateData::class, 'EzSystems\EzPlatformContentForms\Data\Content\ContentCreateData'); diff --git a/src/lib/Data/Content/ContentData.php b/src/lib/Data/Content/ContentData.php index 5ccd00b7..c176e726 100644 --- a/src/lib/Data/Content/ContentData.php +++ b/src/lib/Data/Content/ContentData.php @@ -1,17 +1,19 @@ fieldsData[$fieldData->fieldDefinition->identifier] = $fieldData; } } + +class_alias(ContentData::class, 'EzSystems\EzPlatformContentForms\Data\Content\ContentData'); diff --git a/src/lib/Data/Content/ContentUpdateData.php b/src/lib/Data/Content/ContentUpdateData.php index 3ee609ba..86fa84b0 100644 --- a/src/lib/Data/Content/ContentUpdateData.php +++ b/src/lib/Data/Content/ContentUpdateData.php @@ -1,19 +1,19 @@ fieldDefinition->fieldTypeIdentifier; - } -} - -class_alias( - FieldData::class, - \EzSystems\RepositoryForms\Data\Content\FieldData::class -); diff --git a/src/lib/Data/ContentTranslationData.php b/src/lib/Data/ContentTranslationData.php index 2ca9edb4..5b40f0e1 100644 --- a/src/lib/Data/ContentTranslationData.php +++ b/src/lib/Data/ContentTranslationData.php @@ -1,18 +1,18 @@ setRequired(['mainLanguageCode', 'parentLocation']) - ->setAllowedTypes('parentLocation', '\eZ\Publish\API\Repository\Values\Content\LocationCreateStruct'); + ->setAllowedTypes('parentLocation', '\\Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\LocationCreateStruct'); } } + +class_alias(ContentCreateMapper::class, 'EzSystems\EzPlatformContentForms\Data\Mapper\ContentCreateMapper'); diff --git a/src/lib/Data/Mapper/ContentUpdateMapper.php b/src/lib/Data/Mapper/ContentUpdateMapper.php index 3367f005..88729e6d 100644 --- a/src/lib/Data/Mapper/ContentUpdateMapper.php +++ b/src/lib/Data/Mapper/ContentUpdateMapper.php @@ -1,28 +1,28 @@ setDefault('currentFields', []); } } + +class_alias(ContentUpdateMapper::class, 'EzSystems\EzPlatformContentForms\Data\Mapper\ContentUpdateMapper'); diff --git a/src/lib/Data/Mapper/FormDataMapperInterface.php b/src/lib/Data/Mapper/FormDataMapperInterface.php index f58b68b0..9db7b7c3 100644 --- a/src/lib/Data/Mapper/FormDataMapperInterface.php +++ b/src/lib/Data/Mapper/FormDataMapperInterface.php @@ -1,27 +1,29 @@ setRequired('mainLanguageCode'); } } + +class_alias(UserCreateMapper::class, 'EzSystems\EzPlatformContentForms\Data\Mapper\UserCreateMapper'); diff --git a/src/lib/Data/Mapper/UserUpdateMapper.php b/src/lib/Data/Mapper/UserUpdateMapper.php index 9745fa6b..ec871630 100644 --- a/src/lib/Data/Mapper/UserUpdateMapper.php +++ b/src/lib/Data/Mapper/UserUpdateMapper.php @@ -1,23 +1,17 @@ setRequired(['languageCode']); } } + +class_alias(UserUpdateMapper::class, 'EzSystems\EzPlatformContentForms\Data\Mapper\UserUpdateMapper'); diff --git a/src/lib/Data/NewnessCheckable.php b/src/lib/Data/NewnessCheckable.php index eae54ce1..0bd8efde 100644 --- a/src/lib/Data/NewnessCheckable.php +++ b/src/lib/Data/NewnessCheckable.php @@ -1,12 +1,12 @@ enabled = $enabled; } } + +class_alias(UserAccountFieldData::class, 'EzSystems\EzPlatformContentForms\Data\User\UserAccountFieldData'); diff --git a/src/lib/Data/User/UserCreateData.php b/src/lib/Data/User/UserCreateData.php index d6cb26b1..fe8e2a6c 100644 --- a/src/lib/Data/User/UserCreateData.php +++ b/src/lib/Data/User/UserCreateData.php @@ -1,38 +1,43 @@ parentGroups = $parentGroups; } + + public function getRole(): ?Role + { + return $this->role; + } + + public function setRole(?Role $role): void + { + $this->role = $role; + } + + public function getRoleLimitation(): ?RoleLimitation + { + return $this->roleLimitation; + } + + public function setRoleLimitation(?RoleLimitation $roleLimitation): void + { + $this->roleLimitation = $roleLimitation; + } } + +class_alias(UserCreateData::class, 'EzSystems\EzPlatformContentForms\Data\User\UserCreateData'); diff --git a/src/lib/Data/User/UserUpdateData.php b/src/lib/Data/User/UserUpdateData.php index 53ba65a8..d7b3f63d 100644 --- a/src/lib/Data/User/UserUpdateData.php +++ b/src/lib/Data/User/UserUpdateData.php @@ -1,32 +1,32 @@ options[$option] ?? null; } } + +class_alias(ContentCreateFieldOptionsEvent::class, 'EzSystems\EzPlatformContentForms\Event\ContentCreateFieldOptionsEvent'); diff --git a/src/lib/Event/ContentFormEvents.php b/src/lib/Event/ContentFormEvents.php index 0f0b8f1e..e25d4560 100644 --- a/src/lib/Event/ContentFormEvents.php +++ b/src/lib/Event/ContentFormEvents.php @@ -1,67 +1,69 @@ options[$option] ?? null; } } + +class_alias(ContentUpdateFieldOptionsEvent::class, 'EzSystems\EzPlatformContentForms\Event\ContentUpdateFieldOptionsEvent'); diff --git a/src/lib/Event/FormActionEvent.php b/src/lib/Event/FormActionEvent.php index 7647a010..5a507747 100644 --- a/src/lib/Event/FormActionEvent.php +++ b/src/lib/Event/FormActionEvent.php @@ -1,12 +1,12 @@ payloads[$name] = $payload; } } + +class_alias(FormActionEvent::class, 'EzSystems\EzPlatformContentForms\Event\FormActionEvent'); diff --git a/src/lib/EventListener/ViewTemplatesListener.php b/src/lib/EventListener/ViewTemplatesListener.php index c1b53d48..6d22e7f7 100644 --- a/src/lib/EventListener/ViewTemplatesListener.php +++ b/src/lib/EventListener/ViewTemplatesListener.php @@ -1,20 +1,20 @@ valueClass($properties); } } + +class_alias(AbstractBinaryBaseTransformer::class, 'EzSystems\EzPlatformContentForms\FieldType\DataTransformer\AbstractBinaryBaseTransformer'); diff --git a/src/lib/FieldType/DataTransformer/AuthorValueTransformer.php b/src/lib/FieldType/DataTransformer/AuthorValueTransformer.php index c4bc5600..0bdb8d06 100644 --- a/src/lib/FieldType/DataTransformer/AuthorValueTransformer.php +++ b/src/lib/FieldType/DataTransformer/AuthorValueTransformer.php @@ -1,15 +1,15 @@ getReverseTransformedValue($value); if ($this->fieldType->isEmptyValue($valueObject)) { @@ -55,3 +53,5 @@ public function reverseTransform($value) return $valueObject; } } + +class_alias(BinaryFileValueTransformer::class, 'EzSystems\EzPlatformContentForms\FieldType\DataTransformer\BinaryFileValueTransformer'); diff --git a/src/lib/FieldType/DataTransformer/DateTimeValueTransformer.php b/src/lib/FieldType/DataTransformer/DateTimeValueTransformer.php index c0fcad92..1b67b6bc 100644 --- a/src/lib/FieldType/DataTransformer/DateTimeValueTransformer.php +++ b/src/lib/FieldType/DataTransformer/DateTimeValueTransformer.php @@ -1,14 +1,14 @@ fieldType->fromHash($value); } } + +class_alias(FieldValueTransformer::class, 'EzSystems\EzPlatformContentForms\FieldType\DataTransformer\FieldValueTransformer'); diff --git a/src/lib/FieldType/DataTransformer/ImageAssetValueTransformer.php b/src/lib/FieldType/DataTransformer/ImageAssetValueTransformer.php index e8dcf4a7..dbc54b96 100644 --- a/src/lib/FieldType/DataTransformer/ImageAssetValueTransformer.php +++ b/src/lib/FieldType/DataTransformer/ImageAssetValueTransformer.php @@ -1,21 +1,21 @@ getReverseTransformedValue($value); if ($this->fieldType->isEmptyValue($valueObject)) { @@ -61,3 +59,5 @@ public function reverseTransform($value) return $valueObject; } } + +class_alias(ImageValueTransformer::class, 'EzSystems\EzPlatformContentForms\FieldType\DataTransformer\ImageValueTransformer'); diff --git a/src/lib/FieldType/DataTransformer/KeywordValueTransformer.php b/src/lib/FieldType/DataTransformer/KeywordValueTransformer.php index 1d569132..b77b052c 100644 --- a/src/lib/FieldType/DataTransformer/KeywordValueTransformer.php +++ b/src/lib/FieldType/DataTransformer/KeywordValueTransformer.php @@ -1,14 +1,14 @@ getReverseTransformedValue($value); if ($this->fieldType->isEmptyValue($valueObject)) { @@ -67,3 +65,5 @@ public function reverseTransform($value) return $valueObject; } } + +class_alias(MediaValueTransformer::class, 'EzSystems\EzPlatformContentForms\FieldType\DataTransformer\MediaValueTransformer'); diff --git a/src/lib/FieldType/DataTransformer/MultiSelectionValueTransformer.php b/src/lib/FieldType/DataTransformer/MultiSelectionValueTransformer.php index 2be92408..6403a1a2 100644 --- a/src/lib/FieldType/DataTransformer/MultiSelectionValueTransformer.php +++ b/src/lib/FieldType/DataTransformer/MultiSelectionValueTransformer.php @@ -1,14 +1,14 @@ $this->countriesInfo[$value]]); } } + +class_alias(SingleCountryValueTransformer::class, 'EzSystems\EzPlatformContentForms\FieldType\DataTransformer\SingleCountryValueTransformer'); diff --git a/src/lib/FieldType/DataTransformer/SingleSelectionValueTransformer.php b/src/lib/FieldType/DataTransformer/SingleSelectionValueTransformer.php index f5528c36..e85c00c4 100644 --- a/src/lib/FieldType/DataTransformer/SingleSelectionValueTransformer.php +++ b/src/lib/FieldType/DataTransformer/SingleSelectionValueTransformer.php @@ -1,14 +1,14 @@ mappers[$fieldTypeIdentifier]->mapFieldValueForm($fieldForm, $data); } } + +class_alias(FieldTypeFormMapperDispatcher::class, 'EzSystems\EzPlatformContentForms\FieldType\FieldTypeFormMapperDispatcher'); diff --git a/src/lib/FieldType/FieldTypeFormMapperDispatcherInterface.php b/src/lib/FieldType/FieldTypeFormMapperDispatcherInterface.php index 7b49b10f..b4c26474 100644 --- a/src/lib/FieldType/FieldTypeFormMapperDispatcherInterface.php +++ b/src/lib/FieldType/FieldTypeFormMapperDispatcherInterface.php @@ -1,14 +1,15 @@ locationService->loadLocation((int)$defaultLocationId); } catch (NotFoundException | UnauthorizedException $e) { } @@ -74,3 +80,5 @@ protected function loadDefaultLocationForSelection($defaultLocationId = null): ? return null; } } + +class_alias(AbstractRelationFormMapper::class, 'EzSystems\EzPlatformContentForms\FieldType\Mapper\AbstractRelationFormMapper'); diff --git a/src/lib/FieldType/Mapper/AuthorFormMapper.php b/src/lib/FieldType/Mapper/AuthorFormMapper.php index 21bad28f..6649ce07 100644 --- a/src/lib/FieldType/Mapper/AuthorFormMapper.php +++ b/src/lib/FieldType/Mapper/AuthorFormMapper.php @@ -1,16 +1,16 @@ fieldDefinition; $formConfig = $fieldForm->getConfig(); + $fieldSettings = $fieldDefinition->getFieldSettings(); $fieldForm ->add( $formConfig->getFormFactory()->createBuilder() - ->create('value', RelationFieldType::class, [ - 'required' => $fieldDefinition->isRequired, - 'label' => $fieldDefinition->getName(), - 'default_location' => $this->loadDefaultLocationForSelection( - $fieldDefinition->getFieldSettings()['selectionRoot'] - ), - ]) + ->create( + 'value', + RelationFieldType::class, + [ + 'required' => $fieldDefinition->isRequired, + 'label' => $fieldDefinition->getName(), + 'default_location' => $this->loadDefaultLocationForSelection( + $fieldSettings['selectionRoot'], + $fieldForm->getConfig()->getOption('location'), + ), + 'root_default_location' => $fieldSettings['rootDefaultLocation'] ?? false, + ] + ) ->setAutoInitialize(false) ->getForm() ); } } + +class_alias(RelationFormMapper::class, 'EzSystems\EzPlatformContentForms\FieldType\Mapper\RelationFormMapper'); diff --git a/src/lib/FieldType/Mapper/RelationListFormMapper.php b/src/lib/FieldType/Mapper/RelationListFormMapper.php index 28683aa7..5e5b4067 100644 --- a/src/lib/FieldType/Mapper/RelationListFormMapper.php +++ b/src/lib/FieldType/Mapper/RelationListFormMapper.php @@ -1,15 +1,15 @@ fieldDefinition; $formConfig = $fieldForm->getConfig(); + $fieldSettings = $fieldDefinition->getFieldSettings(); $fieldForm ->add( @@ -29,8 +30,10 @@ public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data) 'required' => $fieldDefinition->isRequired, 'label' => $fieldDefinition->getName(), 'default_location' => $this->loadDefaultLocationForSelection( - $fieldDefinition->getFieldSettings()['selectionDefaultLocation'] + $fieldSettings['selectionDefaultLocation'], + $fieldForm->getConfig()->getOption('location'), ), + 'root_default_location' => $fieldSettings['rootDefaultLocation'] ?? false, ] ) ->setAutoInitialize(false) @@ -38,3 +41,5 @@ public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data) ); } } + +class_alias(RelationListFormMapper::class, 'EzSystems\EzPlatformContentForms\FieldType\Mapper\RelationListFormMapper'); diff --git a/src/lib/FieldType/Mapper/SelectionFormMapper.php b/src/lib/FieldType/Mapper/SelectionFormMapper.php index c14d14df..f6f3e2ed 100644 --- a/src/lib/FieldType/Mapper/SelectionFormMapper.php +++ b/src/lib/FieldType/Mapper/SelectionFormMapper.php @@ -1,16 +1,16 @@ true, 'label' => $fieldDefinition->getName(), 'intent' => $formIntent, - 'constraints' => [ - new UserAccountPassword(['contentType' => $rootForm->getData()->contentType]), - ], ]); if ($isTranslation) { @@ -84,17 +76,17 @@ public function configureOptions(OptionsResolver $resolver) } /** - * @param \eZ\Publish\API\Repository\Values\ContentType\FieldDefinition $fieldDefinition + * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinition $fieldDefinition * * @return \Symfony\Component\Form\CallbackTransformer */ public function getModelTransformerForTranslation(FieldDefinition $fieldDefinition): CallbackTransformer { return new CallbackTransformer( - function (ApiUserValue $data) { + static function (ApiUserValue $data) { return new UserAccountFieldData($data->login, null, $data->email, $data->enabled); }, - function (UserAccountFieldData $submittedData) use ($fieldDefinition) { + static function (UserAccountFieldData $submittedData) use ($fieldDefinition) { $userValue = clone $fieldDefinition->defaultValue; $userValue->login = $submittedData->username; $userValue->email = $submittedData->email; @@ -111,12 +103,14 @@ function (UserAccountFieldData $submittedData) use ($fieldDefinition) { public function getModelTransformer(): CallbackTransformer { return new CallbackTransformer( - function (ApiUserValue $data) { + static function (ApiUserValue $data) { return new UserAccountFieldData($data->login, null, $data->email, $data->enabled); }, - function (UserAccountFieldData $submittedData) { + static function (UserAccountFieldData $submittedData) { return $submittedData; } ); } } + +class_alias(UserAccountFieldValueFormMapper::class, 'EzSystems\EzPlatformContentForms\FieldType\Mapper\UserAccountFieldValueFormMapper'); diff --git a/src/lib/Form/ActionDispatcher/AbstractActionDispatcher.php b/src/lib/Form/ActionDispatcher/AbstractActionDispatcher.php index d9f6976f..9d201f64 100644 --- a/src/lib/Form/ActionDispatcher/AbstractActionDispatcher.php +++ b/src/lib/Form/ActionDispatcher/AbstractActionDispatcher.php @@ -1,15 +1,15 @@ response; } } + +class_alias(AbstractActionDispatcher::class, 'EzSystems\EzPlatformContentForms\Form\ActionDispatcher\AbstractActionDispatcher'); diff --git a/src/lib/Form/ActionDispatcher/ActionDispatcherInterface.php b/src/lib/Form/ActionDispatcher/ActionDispatcherInterface.php index 78f58043..7a8221e3 100644 --- a/src/lib/Form/ActionDispatcher/ActionDispatcherInterface.php +++ b/src/lib/Form/ActionDispatcher/ActionDispatcherInterface.php @@ -1,14 +1,14 @@ getData(); $form = $event->getForm(); $languageCode = $form->getConfig()->getOption('languageCode'); @@ -51,7 +50,7 @@ public function handleUserAccountField(FormEvent $event) } /** - * @param UserCreateData $data + * @param \Ibexa\ContentForms\Data\User\UserCreateData $data */ private function handleUserCreateData(UserCreateData $data) { @@ -60,14 +59,14 @@ private function handleUserCreateData(UserCreateData $data) continue; } - /** @var UserAccountFieldData $userAccountFieldData */ + /** @var \Ibexa\ContentForms\Data\User\UserAccountFieldData $userAccountFieldData */ $userAccountFieldData = $fieldData->value; $data->login = $userAccountFieldData->username; $data->email = $userAccountFieldData->email; $data->password = $userAccountFieldData->password; $data->enabled = $userAccountFieldData->enabled ?? $data->enabled; - /** @var Value $userValue */ + /** @var \Ibexa\Core\FieldType\User\Value $userValue */ $userValue = clone $data->contentType ->getFieldDefinition($fieldData->field->fieldDefIdentifier)->defaultValue; $userValue->login = $data->login; @@ -82,7 +81,7 @@ private function handleUserCreateData(UserCreateData $data) } /** - * @param UserUpdateData $data + * @param \Ibexa\ContentForms\Data\User\UserUpdateData $data * @param $languageCode */ private function handleUserUpdateData(UserUpdateData $data, $languageCode) @@ -92,13 +91,13 @@ private function handleUserUpdateData(UserUpdateData $data, $languageCode) continue; } - /** @var UserAccountFieldData $userAccountFieldData */ + /** @var \Ibexa\ContentForms\Data\User\UserAccountFieldData $userAccountFieldData */ $userAccountFieldData = $fieldData->value; $data->email = $userAccountFieldData->email; $data->password = $userAccountFieldData->password; $data->enabled = $userAccountFieldData->enabled; - /** @var Value $userValue */ + /** @var \Ibexa\Core\FieldType\User\Value $userValue */ $userValue = clone $data->user->getField($fieldData->field->fieldDefIdentifier, $languageCode)->value; $userValue->email = $data->email; $userValue->enabled = $data->enabled; @@ -109,3 +108,5 @@ private function handleUserUpdateData(UserUpdateData $data, $languageCode) } } } + +class_alias(UserFieldsSubscriber::class, 'EzSystems\EzPlatformContentForms\Form\EventSubscriber\UserFieldsSubscriber'); diff --git a/src/lib/Form/Processor/ContentFormProcessor.php b/src/lib/Form/Processor/ContentFormProcessor.php index a0c0a4db..306a7f4d 100644 --- a/src/lib/Form/Processor/ContentFormProcessor.php +++ b/src/lib/Form/Processor/ContentFormProcessor.php @@ -1,24 +1,24 @@ getData(); $form = $event->getForm(); @@ -93,7 +93,7 @@ public function processSaveDraft(FormActionEvent $event) $event->setPayload('content', $draft); $event->setPayload('is_new', $draft->contentInfo->isDraft()); - $defaultUrl = $this->router->generate('ezplatform.content.draft.edit', [ + $defaultUrl = $this->router->generate('ibexa.content.draft.edit', [ 'contentId' => $draft->id, 'versionNo' => $draft->getVersionInfo()->versionNo, 'language' => $languageCode, @@ -103,18 +103,18 @@ public function processSaveDraft(FormActionEvent $event) } /** - * @param \EzSystems\EzPlatformContentForms\Event\FormActionEvent $event + * @param \Ibexa\ContentForms\Event\FormActionEvent $event * - * @throws \eZ\Publish\API\Repository\Exceptions\BadStateException - * @throws \eZ\Publish\API\Repository\Exceptions\ContentFieldValidationException - * @throws \eZ\Publish\API\Repository\Exceptions\ContentValidationException - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException - * @throws \eZ\Publish\Core\Base\Exceptions\InvalidArgumentException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ContentFieldValidationException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ContentValidationException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws \Ibexa\Core\Base\Exceptions\InvalidArgumentException */ public function processPublish(FormActionEvent $event) { - /** @var \EzSystems\EzPlatformContentForms\Data\Content\ContentCreateData|\EzSystems\EzPlatformContentForms\Data\Content\ContentUpdateData $data */ + /** @var \Ibexa\ContentForms\Data\Content\ContentCreateData|\Ibexa\ContentForms\Data\Content\ContentUpdateData $data */ $data = $event->getData(); $form = $event->getForm(); $referrerLocation = $event->getOption('referrerLocation'); @@ -131,7 +131,8 @@ public function processPublish(FormActionEvent $event) : $content->contentInfo->mainLocationId; $redirectUrl = $form['redirectUrlAfterPublish']->getData() ?: $this->router->generate( - '_ez_content_view', [ + 'ibexa.content.view', + [ 'contentId' => $content->id, 'locationId' => $locationId, ] @@ -141,20 +142,21 @@ public function processPublish(FormActionEvent $event) } /** - * @param \EzSystems\EzPlatformContentForms\Event\FormActionEvent $event + * @param \Ibexa\ContentForms\Event\FormActionEvent $event * - * @throws \eZ\Publish\API\Repository\Exceptions\BadStateException - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException */ public function processCancel(FormActionEvent $event) { - /** @var \EzSystems\EzPlatformContentForms\Data\Content\ContentCreateData|\EzSystems\EzPlatformContentForms\Data\Content\ContentUpdateData $data */ + /** @var \Ibexa\ContentForms\Data\Content\ContentCreateData|\Ibexa\ContentForms\Data\Content\ContentUpdateData $data */ $data = $event->getData(); if ($data->isNew()) { $parentLocation = $this->locationService->loadLocation($data->getLocationStructs()[0]->parentLocationId); $response = new RedirectResponse($this->router->generate( - '_ez_content_view', [ + 'ibexa.content.view', + [ 'contentId' => $parentLocation->contentId, 'locationId' => $parentLocation->id, ] @@ -183,7 +185,8 @@ public function processCancel(FormActionEvent $event) $this->contentService->deleteVersion($versionInfo); $url = $this->router->generate( - '_ez_content_view', [ + 'ibexa.content.view', + [ 'contentId' => $redirectionContentId, 'locationId' => $redirectionLocationId, ], @@ -194,14 +197,14 @@ public function processCancel(FormActionEvent $event) } /** - * @param \EzSystems\EzPlatformContentForms\Event\FormActionEvent $event + * @param \Ibexa\ContentForms\Event\FormActionEvent $event * - * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException */ public function processCreateDraft(FormActionEvent $event) { - /** @var $createContentDraft \EzSystems\EzPlatformContentForms\Data\Content\CreateContentDraftData */ + /** @var $createContentDraft \Ibexa\ContentForms\Data\Content\CreateContentDraftData */ $createContentDraft = $event->getData(); $contentInfo = $this->contentService->loadContentInfo($createContentDraft->contentId); @@ -212,7 +215,7 @@ public function processCreateDraft(FormActionEvent $event) $event->setPayload('content', $contentDraft); $event->setPayload('is_new', $contentDraft->contentInfo->isDraft()); - $contentEditUrl = $this->router->generate('ezplatform.content.draft.edit', [ + $contentEditUrl = $this->router->generate('ibexa.content.draft.edit', [ 'contentId' => $contentDraft->id, 'versionNo' => $contentDraft->getVersionInfo()->versionNo, 'language' => $contentDraft->contentInfo->mainLanguageCode, @@ -225,17 +228,17 @@ public function processCreateDraft(FormActionEvent $event) * Saves content draft corresponding to $data. * Depending on the nature of $data (create or update data), the draft will either be created or simply updated. * - * @param ContentStruct|\EzSystems\EzPlatformContentForms\Data\Content\ContentCreateData|\EzSystems\EzPlatformContentForms\Data\Content\ContentUpdateData $data + * @param \Ibexa\Contracts\Core\Repository\Values\Content\ContentStruct|\Ibexa\ContentForms\Data\Content\ContentCreateData|\Ibexa\ContentForms\Data\Content\ContentUpdateData $data * @param $languageCode * - * @return \eZ\Publish\API\Repository\Values\Content\Content + * @return \Ibexa\Contracts\Core\Repository\Values\Content\Content * - * @throws \eZ\Publish\API\Repository\Exceptions\BadStateException - * @throws \eZ\Publish\API\Repository\Exceptions\ContentFieldValidationException - * @throws \eZ\Publish\API\Repository\Exceptions\ContentValidationException - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException - * @throws \eZ\Publish\Core\Base\Exceptions\InvalidArgumentException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ContentFieldValidationException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ContentValidationException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws \Ibexa\Core\Base\Exceptions\InvalidArgumentException */ private function saveDraft(ContentStruct $data, string $languageCode, ?array $fieldIdentifiersToValidate = null) { @@ -258,11 +261,11 @@ private function saveDraft(ContentStruct $data, string $languageCode, ?array $fi } /** - * @param \EzSystems\EzPlatformContentForms\Data\Content\ContentCreateData|\EzSystems\EzPlatformContentForms\Data\Content\ContentUpdateData $data + * @param \Ibexa\ContentForms\Data\Content\ContentCreateData|\Ibexa\ContentForms\Data\Content\ContentUpdateData $data * * @return string * - * @throws \eZ\Publish\Core\Base\Exceptions\InvalidArgumentException + * @throws \Ibexa\Core\Base\Exceptions\InvalidArgumentException */ private function resolveMainLanguageCode($data): string { @@ -279,14 +282,14 @@ private function resolveMainLanguageCode($data): string } /** - * @param \eZ\Publish\API\Repository\Values\Content\Content $content - * @param \eZ\Publish\API\Repository\Values\Content\Location|null $referrerLocation - * @param \EzSystems\EzPlatformContentForms\Data\NewnessCheckable $data + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content $content + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location|null $referrerLocation + * @param \Ibexa\ContentForms\Data\NewnessCheckable $data * - * @return \eZ\Publish\API\Repository\Values\Content\Location|null + * @return \Ibexa\Contracts\Core\Repository\Values\Content\Location|null * - * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException */ private function resolveLocation(Content $content, ?Location $referrerLocation, NewnessCheckable $data): ?Location { @@ -297,3 +300,5 @@ private function resolveLocation(Content $content, ?Location $referrerLocation, return $referrerLocation ?? $this->locationService->loadLocation($content->contentInfo->mainLocationId); } } + +class_alias(ContentFormProcessor::class, 'EzSystems\EzPlatformContentForms\Form\Processor\ContentFormProcessor'); diff --git a/src/lib/Form/Processor/SystemUrlRedirectProcessor.php b/src/lib/Form/Processor/SystemUrlRedirectProcessor.php index 215c0d6b..d267fe2b 100644 --- a/src/lib/Form/Processor/SystemUrlRedirectProcessor.php +++ b/src/lib/Form/Processor/SystemUrlRedirectProcessor.php @@ -1,17 +1,17 @@ setResponse(new RedirectResponse($this->urlAliasService->reverseLookup($location)->path)); } } + +class_alias(SystemUrlRedirectProcessor::class, 'EzSystems\EzPlatformContentForms\Form\Processor\SystemUrlRedirectProcessor'); diff --git a/src/lib/Form/Processor/User/UserCancelFormProcessor.php b/src/lib/Form/Processor/User/UserCancelFormProcessor.php index 2965ac9f..0cb5204d 100644 --- a/src/lib/Form/Processor/User/UserCancelFormProcessor.php +++ b/src/lib/Form/Processor/User/UserCancelFormProcessor.php @@ -1,17 +1,15 @@ getData(); $contentInfo = $data->isNew() ? $data->getParentGroups()[0]->contentInfo : $data->user->contentInfo; - $response = new RedirectResponse($this->urlGenerator->generate('_ez_content_view', [ + $response = new RedirectResponse($this->urlGenerator->generate('ibexa.content.view', [ 'contentId' => $contentInfo->id, 'locationId' => $contentInfo->mainLocationId, ])); $event->setResponse($response); } } + +class_alias(UserCancelFormProcessor::class, 'EzSystems\EzPlatformContentForms\Form\Processor\User\UserCancelFormProcessor'); diff --git a/src/lib/Form/Processor/User/UserCreateFormProcessor.php b/src/lib/Form/Processor/User/UserCreateFormProcessor.php index 55d05f02..5da5242c 100644 --- a/src/lib/Form/Processor/User/UserCreateFormProcessor.php +++ b/src/lib/Form/Processor/User/UserCreateFormProcessor.php @@ -1,17 +1,17 @@ userService->createUser($data, $data->getParentGroups()); $redirectUrl = $form['redirectUrlAfterPublish']->getData() ?: $this->urlGenerator->generate( - '_ez_content_view', [ + 'ibexa.content.view', + [ 'contentId' => $user->id, 'locationId' => $user->contentInfo->mainLocationId, ], @@ -71,7 +72,7 @@ public function processCreate(FormActionEvent $event) } /** - * @param UserCreateData $data + * @param \Ibexa\ContentForms\Data\User\UserCreateData $data * @param string $languageCode */ private function setContentFields(UserCreateData $data, string $languageCode): void @@ -81,3 +82,5 @@ private function setContentFields(UserCreateData $data, string $languageCode): v } } } + +class_alias(UserCreateFormProcessor::class, 'EzSystems\EzPlatformContentForms\Form\Processor\User\UserCreateFormProcessor'); diff --git a/src/lib/Form/Processor/User/UserUpdateFormProcessor.php b/src/lib/Form/Processor/User/UserUpdateFormProcessor.php index a752a15a..4dc3b251 100644 --- a/src/lib/Form/Processor/User/UserUpdateFormProcessor.php +++ b/src/lib/Form/Processor/User/UserUpdateFormProcessor.php @@ -1,18 +1,18 @@ userService->updateUser($data->user, $data); $redirectUrl = $form['redirectUrlAfterPublish']->getData() ?: $this->urlGenerator->generate( - '_ez_content_view', [ + 'ibexa.content.view', + [ 'contentId' => $user->id, 'locationId' => $user->contentInfo->mainLocationId, ], @@ -73,7 +74,7 @@ public function processUpdate(FormActionEvent $event) } /** - * @param UserUpdateData $data + * @param \Ibexa\ContentForms\Data\User\UserUpdateData $data * @param string $languageCode */ private function setContentFields(UserUpdateData $data, string $languageCode): void @@ -85,3 +86,5 @@ private function setContentFields(UserUpdateData $data, string $languageCode): v } } } + +class_alias(UserUpdateFormProcessor::class, 'EzSystems\EzPlatformContentForms\Form\Processor\User\UserUpdateFormProcessor'); diff --git a/src/lib/Form/Transformer/JsonToArrayTransformer.php b/src/lib/Form/Transformer/JsonToArrayTransformer.php index a08766b7..9ae6111a 100644 --- a/src/lib/Form/Transformer/JsonToArrayTransformer.php +++ b/src/lib/Form/Transformer/JsonToArrayTransformer.php @@ -1,12 +1,12 @@ $location, + 'location_type' => $locationType, + ]; + } + + public function reverseTransform($value): string + { + if ($value === null || $value['location_type'] === RelationType::LOCATION_DEFAULT) { + return ''; + } + + return (string)($value['location_type'] === RelationType::LOCATION_SELF + ? RelationType::LOCATION_SELF + : $value['location']); + } +} diff --git a/src/lib/Form/Type/Content/BaseContentType.php b/src/lib/Form/Type/Content/BaseContentType.php index a2e57765..52b9b620 100644 --- a/src/lib/Form/Type/Content/BaseContentType.php +++ b/src/lib/Form/Type/Content/BaseContentType.php @@ -1,12 +1,12 @@ [ 'languageCode' => $options['languageCode'], 'mainLanguageCode' => $options['mainLanguageCode'], + 'location' => $options['location'] ?? null, 'content' => $options['content'] ?? null, 'contentCreateStruct' => $options['contentCreateStruct'] ?? null, 'contentUpdateStruct' => $options['contentUpdateStruct'] ?? null, @@ -63,3 +64,5 @@ public function configureOptions(OptionsResolver $resolver) ->setRequired(['languageCode', 'mainLanguageCode']); } } + +class_alias(BaseContentType::class, 'EzSystems\EzPlatformContentForms\Form\Type\Content\BaseContentType'); diff --git a/src/lib/Form/Type/Content/ContentDraftCreateType.php b/src/lib/Form/Type/Content/ContentDraftCreateType.php index 103344ba..01346695 100644 --- a/src/lib/Form/Type/Content/ContentDraftCreateType.php +++ b/src/lib/Form/Type/Content/ContentDraftCreateType.php @@ -1,12 +1,12 @@ setDefaults(['translation_domain' => 'ezplatform_content_forms_content']); } } + +class_alias(ContentDraftCreateType::class, 'EzSystems\EzPlatformContentForms\Form\Type\Content\ContentDraftCreateType'); diff --git a/src/lib/Form/Type/Content/ContentEditType.php b/src/lib/Form/Type/Content/ContentEditType.php index 5431e5f3..8efd5892 100644 --- a/src/lib/Form/Type/Content/ContentEditType.php +++ b/src/lib/Form/Type/Content/ContentEditType.php @@ -1,15 +1,15 @@ setDefaults([ + 'location' => null, 'content' => null, 'contentCreateStruct' => null, 'contentUpdateStruct' => null, @@ -86,3 +87,5 @@ public function configureOptions(OptionsResolver $resolver) ]); } } + +class_alias(ContentEditType::class, 'EzSystems\EzPlatformContentForms\Form\Type\Content\ContentEditType'); diff --git a/src/lib/Form/Type/Content/ContentFieldType.php b/src/lib/Form/Type/Content/ContentFieldType.php index 9bfbe8b9..a85041bd 100644 --- a/src/lib/Form/Type/Content/ContentFieldType.php +++ b/src/lib/Form/Type/Content/ContentFieldType.php @@ -1,15 +1,15 @@ setDefaults([ 'content' => null, + 'location' => null, 'contentCreateStruct' => null, 'contentUpdateStruct' => null, 'data_class' => FieldData::class, @@ -55,6 +56,7 @@ public function configureOptions(OptionsResolver $resolver) public function buildView(FormView $view, FormInterface $form, array $options) { + $view->vars['location'] = $options['location']; $view->vars['languageCode'] = $options['languageCode']; $view->vars['mainLanguageCode'] = $options['mainLanguageCode']; } @@ -66,3 +68,5 @@ public function buildForm(FormBuilderInterface $builder, array $options) }); } } + +class_alias(ContentFieldType::class, 'EzSystems\EzPlatformContentForms\Form\Type\Content\ContentFieldType'); diff --git a/src/lib/Form/Type/Content/FieldCollectionType.php b/src/lib/Form/Type/Content/FieldCollectionType.php index a34eceff..4873364b 100644 --- a/src/lib/Form/Type/Content/FieldCollectionType.php +++ b/src/lib/Form/Type/Content/FieldCollectionType.php @@ -1,16 +1,16 @@ isContentUpdate($entryOptions)) { - /** @var \EzSystems\EzPlatformContentForms\Event\ContentUpdateFieldOptionsEvent $contentUpdateFieldOptionsEvent */ + /** @var \Ibexa\ContentForms\Event\ContentUpdateFieldOptionsEvent $contentUpdateFieldOptionsEvent */ $contentUpdateFieldOptionsEvent = $this->eventDispatcher->dispatch( new ContentUpdateFieldOptionsEvent( $entryOptions['content'], @@ -64,7 +64,7 @@ public function buildForm( $entryOptions = $contentUpdateFieldOptionsEvent->getOptions(); } elseif ($this->isContentCreate($entryOptions)) { - /** @var \EzSystems\EzPlatformContentForms\Event\ContentCreateFieldOptionsEvent $contentUpdateFieldOptionsEvent */ + /** @var \Ibexa\ContentForms\Event\ContentCreateFieldOptionsEvent $contentUpdateFieldOptionsEvent */ $contentCreateFieldOptionsEvent = $this->eventDispatcher->dispatch( new ContentCreateFieldOptionsEvent( $entryOptions['contentCreateStruct'], @@ -93,3 +93,5 @@ private function isContentUpdate(array $entryOptions): bool return !empty($entryOptions['content']) && !empty($entryOptions['contentUpdateStruct']); } } + +class_alias(FieldCollectionType::class, 'EzSystems\EzPlatformContentForms\Form\Type\Content\FieldCollectionType'); diff --git a/src/lib/Form/Type/FieldDefinition/User/PasswordConstraintCheckboxType.php b/src/lib/Form/Type/FieldDefinition/User/PasswordConstraintCheckboxType.php index 213ad14c..209fc05c 100644 --- a/src/lib/Form/Type/FieldDefinition/User/PasswordConstraintCheckboxType.php +++ b/src/lib/Form/Type/FieldDefinition/User/PasswordConstraintCheckboxType.php @@ -1,12 +1,12 @@ authors->exchangeArray( array_filter( $value->authors->getArrayCopy(), - function (Author $author) { + static function (Author $author) { return !empty($author->email) || !empty($author->name); } ) @@ -136,7 +136,7 @@ function (Author $author) { /** * Returns currently logged user data, or empty Author object if none was found. * - * @return \eZ\Publish\Core\FieldType\Author\Author + * @return \Ibexa\Core\FieldType\Author\Author */ private function fetchLoggedAuthor(): Author { @@ -157,3 +157,5 @@ private function fetchLoggedAuthor(): Author return $author; } } + +class_alias(AuthorFieldType::class, 'EzSystems\EzPlatformContentForms\Form\Type\FieldType\AuthorFieldType'); diff --git a/src/lib/Form/Type/FieldType/BinaryBaseFieldType.php b/src/lib/Form/Type/FieldType/BinaryBaseFieldType.php index ba3a08ee..1f32facc 100644 --- a/src/lib/Form/Type/FieldType/BinaryBaseFieldType.php +++ b/src/lib/Form/Type/FieldType/BinaryBaseFieldType.php @@ -1,14 +1,14 @@ setDefaults(['translation_domain' => 'ezplatform_content_forms_fieldtype']); } } + +class_alias(BinaryBaseFieldType::class, 'EzSystems\EzPlatformContentForms\Form\Type\FieldType\BinaryBaseFieldType'); diff --git a/src/lib/Form/Type/FieldType/BinaryFileFieldType.php b/src/lib/Form/Type/FieldType/BinaryFileFieldType.php index 123f91ee..c47c8224 100644 --- a/src/lib/Form/Type/FieldType/BinaryFileFieldType.php +++ b/src/lib/Form/Type/FieldType/BinaryFileFieldType.php @@ -1,12 +1,12 @@ setDefaults(['translation_domain' => 'ezplatform_content_forms_fieldtype']); } } + +class_alias(BinaryFileFieldType::class, 'EzSystems\EzPlatformContentForms\Form\Type\FieldType\BinaryFileFieldType'); diff --git a/src/lib/Form/Type/FieldType/CheckboxFieldType.php b/src/lib/Form/Type/FieldType/CheckboxFieldType.php index 8c026596..8205da5b 100644 --- a/src/lib/Form/Type/FieldType/CheckboxFieldType.php +++ b/src/lib/Form/Type/FieldType/CheckboxFieldType.php @@ -1,15 +1,15 @@ addModelTransformer(new FieldValueTransformer($this->fieldTypeService->getFieldType('ezboolean'))); } } + +class_alias(CheckboxFieldType::class, 'EzSystems\EzPlatformContentForms\Form\Type\FieldType\CheckboxFieldType'); diff --git a/src/lib/Form/Type/FieldType/CountryFieldType.php b/src/lib/Form/Type/FieldType/CountryFieldType.php index f93d18f7..864a96ab 100644 --- a/src/lib/Form/Type/FieldType/CountryFieldType.php +++ b/src/lib/Form/Type/FieldType/CountryFieldType.php @@ -1,15 +1,15 @@ vars['isEditView'] = \in_array($request->attributes->get('_route'), self::EDIT_VIEWS); } } + +class_alias(DateFieldType::class, 'EzSystems\EzPlatformContentForms\Form\Type\FieldType\DateFieldType'); diff --git a/src/lib/Form/Type/FieldType/DateTimeFieldType.php b/src/lib/Form/Type/FieldType/DateTimeFieldType.php index a1fbe02a..43427ee2 100644 --- a/src/lib/Form/Type/FieldType/DateTimeFieldType.php +++ b/src/lib/Form/Type/FieldType/DateTimeFieldType.php @@ -1,14 +1,14 @@ setAllowedTypes('with_seconds', 'bool'); } } + +class_alias(DateTimeFieldType::class, 'EzSystems\EzPlatformContentForms\Form\Type\FieldType\DateTimeFieldType'); diff --git a/src/lib/Form/Type/FieldType/FloatFieldType.php b/src/lib/Form/Type/FieldType/FloatFieldType.php index 69a28897..7d9fa946 100644 --- a/src/lib/Form/Type/FieldType/FloatFieldType.php +++ b/src/lib/Form/Type/FieldType/FloatFieldType.php @@ -1,15 +1,15 @@ setAllowedTypes('max', ['float', 'integer', 'null']); } } + +class_alias(FloatFieldType::class, 'EzSystems\EzPlatformContentForms\Form\Type\FieldType\FloatFieldType'); diff --git a/src/lib/Form/Type/FieldType/ISBNFieldType.php b/src/lib/Form/Type/FieldType/ISBNFieldType.php index 819aaa2f..81d64202 100644 --- a/src/lib/Form/Type/FieldType/ISBNFieldType.php +++ b/src/lib/Form/Type/FieldType/ISBNFieldType.php @@ -1,15 +1,15 @@ addModelTransformer(new FieldValueTransformer($this->fieldTypeService->getFieldType('ezisbn'))); } } + +class_alias(ISBNFieldType::class, 'EzSystems\EzPlatformContentForms\Form\Type\FieldType\ISBNFieldType'); diff --git a/src/lib/Form/Type/FieldType/ImageAssetFieldType.php b/src/lib/Form/Type/FieldType/ImageAssetFieldType.php index 6178a128..8d90aafa 100644 --- a/src/lib/Form/Type/FieldType/ImageAssetFieldType.php +++ b/src/lib/Form/Type/FieldType/ImageAssetFieldType.php @@ -1,18 +1,18 @@ maxUploadSize->get(); } } + +class_alias(ImageAssetFieldType::class, 'EzSystems\EzPlatformContentForms\Form\Type\FieldType\ImageAssetFieldType'); diff --git a/src/lib/Form/Type/FieldType/ImageFieldType.php b/src/lib/Form/Type/FieldType/ImageFieldType.php index 21354dca..9eaf8f07 100644 --- a/src/lib/Form/Type/FieldType/ImageFieldType.php +++ b/src/lib/Form/Type/FieldType/ImageFieldType.php @@ -1,14 +1,14 @@ setAllowedTypes('is_alternative_text_required', 'bool'); } } + +class_alias(ImageFieldType::class, 'EzSystems\EzPlatformContentForms\Form\Type\FieldType\ImageFieldType'); diff --git a/src/lib/Form/Type/FieldType/IntegerFieldType.php b/src/lib/Form/Type/FieldType/IntegerFieldType.php index 5a6294f4..4bfca8aa 100644 --- a/src/lib/Form/Type/FieldType/IntegerFieldType.php +++ b/src/lib/Form/Type/FieldType/IntegerFieldType.php @@ -1,15 +1,15 @@ setAllowedTypes('max', ['integer', 'null']); } } + +class_alias(IntegerFieldType::class, 'EzSystems\EzPlatformContentForms\Form\Type\FieldType\IntegerFieldType'); diff --git a/src/lib/Form/Type/FieldType/KeywordFieldType.php b/src/lib/Form/Type/FieldType/KeywordFieldType.php index 11f33a91..115b2b05 100644 --- a/src/lib/Form/Type/FieldType/KeywordFieldType.php +++ b/src/lib/Form/Type/FieldType/KeywordFieldType.php @@ -1,14 +1,14 @@ addModelTransformer(new KeywordValueTransformer()); } } + +class_alias(KeywordFieldType::class, 'EzSystems\EzPlatformContentForms\Form\Type\FieldType\KeywordFieldType'); diff --git a/src/lib/Form/Type/FieldType/MapLocationFieldType.php b/src/lib/Form/Type/FieldType/MapLocationFieldType.php index 819f0139..19318542 100644 --- a/src/lib/Form/Type/FieldType/MapLocationFieldType.php +++ b/src/lib/Form/Type/FieldType/MapLocationFieldType.php @@ -1,15 +1,15 @@ setDefaults(['translation_domain' => 'ezplatform_content_forms_fieldtype']); } } + +class_alias(MapLocationFieldType::class, 'EzSystems\EzPlatformContentForms\Form\Type\FieldType\MapLocationFieldType'); diff --git a/src/lib/Form/Type/FieldType/MediaFieldType.php b/src/lib/Form/Type/FieldType/MediaFieldType.php index eb510cf5..575d9535 100644 --- a/src/lib/Form/Type/FieldType/MediaFieldType.php +++ b/src/lib/Form/Type/FieldType/MediaFieldType.php @@ -1,12 +1,12 @@ setDefaults(['translation_domain' => 'ezplatform_content_forms_fieldtype']); } } + +class_alias(MediaFieldType::class, 'EzSystems\EzPlatformContentForms\Form\Type\FieldType\MediaFieldType'); diff --git a/src/lib/Form/Type/FieldType/RelationFieldType.php b/src/lib/Form/Type/FieldType/RelationFieldType.php index 02247cf5..11dbcc2c 100644 --- a/src/lib/Form/Type/FieldType/RelationFieldType.php +++ b/src/lib/Form/Type/FieldType/RelationFieldType.php @@ -1,19 +1,19 @@ vars['relations'] = []; $view->vars['default_location'] = $options['default_location']; + $view->vars['root_default_location'] = $options['root_default_location']; - /** @var Value $data */ + /** @var \Ibexa\Core\FieldType\Relation\Value $data */ $data = $form->getData(); if (!$data instanceof Value || null === $data->destinationContentId) { @@ -101,8 +102,14 @@ public function configureOptions(OptionsResolver $resolver) 'step' => 1, ], 'default_location' => null, + 'root_default_location' => null, + 'location' => null, ]); $resolver->setAllowedTypes('default_location', ['null', Location::class]); + $resolver->setAllowedTypes('root_default_location', ['null', 'bool']); + $resolver->setAllowedTypes('location', ['null', Location::class]); } } + +class_alias(RelationFieldType::class, 'EzSystems\EzPlatformContentForms\Form\Type\FieldType\RelationFieldType'); diff --git a/src/lib/Form/Type/FieldType/RelationListFieldType.php b/src/lib/Form/Type/FieldType/RelationListFieldType.php index 2447dcf2..8c570f53 100644 --- a/src/lib/Form/Type/FieldType/RelationListFieldType.php +++ b/src/lib/Form/Type/FieldType/RelationListFieldType.php @@ -1,19 +1,19 @@ vars['relations'] = []; $view->vars['default_location'] = $options['default_location']; + $view->vars['root_default_location'] = $options['root_default_location']; - /** @var Value $data */ + /** @var \Ibexa\Core\FieldType\RelationList\Value $data */ $data = $form->getData(); if (!$data instanceof Value) { @@ -102,8 +103,14 @@ public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'default_location' => null, + 'root_default_location' => null, + 'location' => null, ]); $resolver->setAllowedTypes('default_location', ['null', Location::class]); + $resolver->setAllowedTypes('root_default_location', ['null', 'bool']); + $resolver->setAllowedTypes('location', ['null', Location::class]); } } + +class_alias(RelationListFieldType::class, 'EzSystems\EzPlatformContentForms\Form\Type\FieldType\RelationListFieldType'); diff --git a/src/lib/Form/Type/FieldType/SelectionFieldType.php b/src/lib/Form/Type/FieldType/SelectionFieldType.php index 1a9d93bd..fa8e1658 100644 --- a/src/lib/Form/Type/FieldType/SelectionFieldType.php +++ b/src/lib/Form/Type/FieldType/SelectionFieldType.php @@ -1,15 +1,15 @@ setAllowedTypes('rows', ['integer']); } } + +class_alias(TextBlockFieldType::class, 'EzSystems\EzPlatformContentForms\Form\Type\FieldType\TextBlockFieldType'); diff --git a/src/lib/Form/Type/FieldType/TextLineFieldType.php b/src/lib/Form/Type/FieldType/TextLineFieldType.php index 08569ddc..23e8f6bc 100644 --- a/src/lib/Form/Type/FieldType/TextLineFieldType.php +++ b/src/lib/Form/Type/FieldType/TextLineFieldType.php @@ -1,15 +1,15 @@ setAllowedTypes('max', ['integer', 'null']); } } + +class_alias(TextLineFieldType::class, 'EzSystems\EzPlatformContentForms\Form\Type\FieldType\TextLineFieldType'); diff --git a/src/lib/Form/Type/FieldType/TimeFieldType.php b/src/lib/Form/Type/FieldType/TimeFieldType.php index b3e1203d..148cb3d2 100644 --- a/src/lib/Form/Type/FieldType/TimeFieldType.php +++ b/src/lib/Form/Type/FieldType/TimeFieldType.php @@ -1,14 +1,14 @@ setAllowedTypes('with_seconds', 'bool'); } } + +class_alias(TimeFieldType::class, 'EzSystems\EzPlatformContentForms\Form\Type\FieldType\TimeFieldType'); diff --git a/src/lib/Form/Type/FieldType/UrlFieldType.php b/src/lib/Form/Type/FieldType/UrlFieldType.php index a8fdec09..a561a3d4 100644 --- a/src/lib/Form/Type/FieldType/UrlFieldType.php +++ b/src/lib/Form/Type/FieldType/UrlFieldType.php @@ -1,15 +1,15 @@ add('password', RepeatedType::class, [ 'type' => PasswordType::class, 'required' => !$isUpdateForm, + 'invalid_message' => /** @Desc("Passwords do not match.") */ 'content.field_type.passwords_must_match', 'first_options' => ['label' => /** @Desc("Password") */ 'content.field_type.ezuser.password'], 'second_options' => ['label' => /** @Desc("Confirm password") */ 'content.field_type.ezuser.password_confirm'], ]) ->add('email', EmailType::class, [ 'required' => true, 'label' => /** @Desc("Email") */ 'content.field_type.ezuser.email', + 'attr' => [ + 'readonly' => $options['intent'] === 'invitation', + ], ]); if (in_array($options['intent'], ['create', 'update'], true)) { @@ -67,6 +71,8 @@ public function configureOptions(OptionsResolver $resolver) 'translation_domain' => 'ezplatform_content_forms_fieldtype', ]) ->setRequired(['intent']) - ->setAllowedValues('intent', ['register', 'create', 'update']); + ->setAllowedValues('intent', ['register', 'create', 'update', 'invitation']); } } + +class_alias(UserAccountFieldType::class, 'EzSystems\EzPlatformContentForms\Form\Type\FieldType\UserAccountFieldType'); diff --git a/src/lib/Form/Type/JsonArrayType.php b/src/lib/Form/Type/JsonArrayType.php index 6fd6e28f..f5d7ba62 100644 --- a/src/lib/Form/Type/JsonArrayType.php +++ b/src/lib/Form/Type/JsonArrayType.php @@ -1,14 +1,14 @@ addModelTransformer(new JsonToArrayTransformer()); } } + +class_alias(JsonArrayType::class, 'EzSystems\EzPlatformContentForms\Form\Type\JsonArrayType'); diff --git a/src/lib/Form/Type/LocationChoiceType.php b/src/lib/Form/Type/LocationChoiceType.php new file mode 100644 index 00000000..aaf0956d --- /dev/null +++ b/src/lib/Form/Type/LocationChoiceType.php @@ -0,0 +1,25 @@ +locationService = $locationService; + $this->translator = $translator; + } + + public function getBlockPrefix() + { + return 'ibexa_form_type_relation'; + } + + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { + $builder + ->add('location', LocationType::class) + ->add('location_type', LocationChoiceType::class, [ + 'multiple' => false, + 'expanded' => true, + 'label' => /** @Desc("Select Starting Location") */ 'content_forms.relation.location_type', + 'choices' => [ + /** @Desc("Default") */ + 'content_forms.relation.location_type.default' => self::LOCATION_DEFAULT, + /** @Desc("Browse") */ + 'content_forms.relation.location_type.browse' => self::LOCATION_BROWSE, + /** @Desc("Content location") */ + 'content_forms.relation.location_type.self' => self::LOCATION_SELF, + ], + ]); + + $builder->addModelTransformer(new RelationTransformer()); + } + + public function buildView( + FormView $view, + FormInterface $form, + array $options + ) { + $view->vars['destination_location'] = null; + $value = $form->getData(); + + if (!empty($value)) { + try { + $view->vars['destination_location'] = $this->locationService->loadLocation( + (int)$value + ); + } catch (NotFoundException | UnauthorizedException $e) { + } + } + } + + public function configureOptions(OptionsResolver $resolver): void + { + $resolver + ->setDefaults([ + 'translation_domain' => 'ibexa_content_forms_fieldtype', + ]); + } +} diff --git a/src/lib/Form/Type/SwitcherType.php b/src/lib/Form/Type/SwitcherType.php index 7450ed12..3856534d 100644 --- a/src/lib/Form/Type/SwitcherType.php +++ b/src/lib/Form/Type/SwitcherType.php @@ -1,12 +1,12 @@ setDefault('required', false); } } + +class_alias(SwitcherType::class, 'EzSystems\EzPlatformContentForms\Form\Type\SwitcherType'); diff --git a/src/lib/Form/Type/User/BaseUserType.php b/src/lib/Form/Type/User/BaseUserType.php index 96c053a6..43aff243 100644 --- a/src/lib/Form/Type/User/BaseUserType.php +++ b/src/lib/Form/Type/User/BaseUserType.php @@ -1,16 +1,16 @@ setAllowedValues('intent', ['update', 'create', 'register']); } } + +class_alias(BaseUserType::class, 'EzSystems\EzPlatformContentForms\Form\Type\User\BaseUserType'); diff --git a/src/lib/Form/Type/User/UserCreateType.php b/src/lib/Form/Type/User/UserCreateType.php index 8c780c47..7669cb9d 100644 --- a/src/lib/Form/Type/User/UserCreateType.php +++ b/src/lib/Form/Type/User/UserCreateType.php @@ -1,14 +1,14 @@ setDefaults([ + 'location' => null, 'data_class' => UserUpdateData::class, 'intent' => 'update', 'translation_domain' => 'ezplatform_content_forms_user', ]); } } + +class_alias(UserUpdateType::class, 'EzSystems\EzPlatformContentForms\Form\Type\User\UserUpdateType'); diff --git a/src/lib/User/View/UserCreateView.php b/src/lib/User/View/UserCreateView.php index 9ffc1622..8c47ce5b 100644 --- a/src/lib/User/View/UserCreateView.php +++ b/src/lib/User/View/UserCreateView.php @@ -1,15 +1,17 @@ getFieldValue($value); - if (!$fieldValue) { - return; - } $fieldTypeIdentifier = $this->getFieldTypeIdentifier($value); $fieldDefinition = $this->getFieldDefinition($value); $fieldType = $this->fieldTypeService->getFieldType($fieldTypeIdentifier); - if ($fieldDefinition->isRequired && $fieldType->isEmptyValue($fieldValue)) { + if ($fieldDefinition->isRequired && ($fieldValue === null || $fieldType->isEmptyValue($fieldValue))) { $validationErrors = [ new ValidationError( "Value for required field definition '%identifier%' with language '%languageCode%' is empty", @@ -51,8 +48,10 @@ public function validate($value, Constraint $constraint): void 'empty' ), ]; - } else { + } elseif ($fieldValue !== null) { $validationErrors = $fieldType->validateValue($fieldDefinition, $fieldValue); + } else { + $validationErrors = []; } $this->processValidationErrors($validationErrors); @@ -78,7 +77,7 @@ protected function getFieldDefinition(FieldData $value): FieldDefinition /** * Returns the fieldTypeIdentifier for the field value to validate. * - * @param FieldData|ValueObject $value fieldData ValueObject holding the field value to validate + * @param \Ibexa\Contracts\ContentForms\Data\Content\FieldData|\Ibexa\Contracts\Core\Repository\Values\ValueObject $value fieldData ValueObject holding the field value to validate * * @return string */ @@ -96,3 +95,5 @@ protected function generatePropertyPath($errorIndex, $errorTarget): string : PropertyPath::append($basePath, $errorTarget); } } + +class_alias(FieldValueValidator::class, 'EzSystems\EzPlatformContentForms\Validator\Constraints\FieldValueValidator'); diff --git a/src/lib/Validator/Constraints/FieldValueValidatorMessages.php b/src/lib/Validator/Constraints/FieldValueValidatorMessages.php index c5c870db..41a95a2f 100644 --- a/src/lib/Validator/Constraints/FieldValueValidatorMessages.php +++ b/src/lib/Validator/Constraints/FieldValueValidatorMessages.php @@ -1,15 +1,15 @@ context); } } + +class_alias(PasswordValidator::class, 'EzSystems\EzPlatformContentForms\Validator\Constraints\PasswordValidator'); diff --git a/src/lib/Validator/Constraints/UserAccountPassword.php b/src/lib/Validator/Constraints/UserAccountPassword.php index 3377751a..23420491 100644 --- a/src/lib/Validator/Constraints/UserAccountPassword.php +++ b/src/lib/Validator/Constraints/UserAccountPassword.php @@ -1,13 +1,15 @@ context, function () { + return new ValidationErrorsProcessor($this->context, static function () { return 'password'; }); } } + +class_alias(UserAccountPasswordValidator::class, 'EzSystems\EzPlatformContentForms\Validator\Constraints\UserAccountPasswordValidator'); diff --git a/src/lib/Validator/ValidationErrorsProcessor.php b/src/lib/Validator/ValidationErrorsProcessor.php index a9500c88..f8d5e4b5 100644 --- a/src/lib/Validator/ValidationErrorsProcessor.php +++ b/src/lib/Validator/ValidationErrorsProcessor.php @@ -1,14 +1,14 @@ getGroupedFields([$form1, $form2, $form3]); $expected = [ - "Group 1" => [ - 0 => "first_field", + 'Group 1' => [ + 0 => 'first_field', ], - "Group 2" => [ - 0 => "second_field", - 1 => "third_field", + 'Group 2' => [ + 0 => 'second_field', + 1 => 'third_field', ], ]; diff --git a/tests/lib/Data/Mapper/ContentUpdateMapperTest.php b/tests/lib/Data/Mapper/ContentUpdateMapperTest.php index 8c583210..be92153e 100644 --- a/tests/lib/Data/Mapper/ContentUpdateMapperTest.php +++ b/tests/lib/Data/Mapper/ContentUpdateMapperTest.php @@ -8,17 +8,17 @@ namespace Ibexa\Tests\ContentForms\Data\Mapper; -use eZ\Publish\API\Repository\Values\Content\ContentInfo; -use eZ\Publish\API\Repository\Values\Content\Field as APIField; -use eZ\Publish\API\Repository\Values\Content\Language; -use eZ\Publish\API\Repository\Values\Content\Section; -use eZ\Publish\Core\Repository\Values\Content\Content; -use eZ\Publish\Core\Repository\Values\Content\Location as APILocation; -use eZ\Publish\Core\Repository\Values\Content\VersionInfo; -use eZ\Publish\Core\Repository\Values\ContentType\ContentType; -use eZ\Publish\Core\Repository\Values\ContentType\FieldDefinition; -use eZ\Publish\Core\Repository\Values\ContentType\FieldDefinitionCollection; -use EzSystems\EzPlatformContentForms\Data\Mapper\ContentUpdateMapper; +use Ibexa\ContentForms\Data\Mapper\ContentUpdateMapper; +use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; +use Ibexa\Contracts\Core\Repository\Values\Content\Field as APIField; +use Ibexa\Contracts\Core\Repository\Values\Content\Language; +use Ibexa\Contracts\Core\Repository\Values\Content\Section; +use Ibexa\Core\Repository\Values\Content\Content; +use Ibexa\Core\Repository\Values\Content\Location as APILocation; +use Ibexa\Core\Repository\Values\Content\VersionInfo; +use Ibexa\Core\Repository\Values\ContentType\ContentType; +use Ibexa\Core\Repository\Values\ContentType\FieldDefinition; +use Ibexa\Core\Repository\Values\ContentType\FieldDefinitionCollection; use PHPUnit\Framework\TestCase; final class ContentUpdateMapperTest extends TestCase diff --git a/src/lib/Tests/Event/FormActionEventTest.php b/tests/lib/Event/FormActionEventTest.php similarity index 83% rename from src/lib/Tests/Event/FormActionEventTest.php rename to tests/lib/Event/FormActionEventTest.php index ae46a92e..7cfdfcd3 100644 --- a/src/lib/Tests/Event/FormActionEventTest.php +++ b/tests/lib/Event/FormActionEventTest.php @@ -1,18 +1,18 @@ createMock(FormInterface::class), - new stdClass(), 'fooButton' + new stdClass(), + 'fooButton' ); self::assertFalse($event->hasResponse()); self::assertNull($event->getResponse()); @@ -44,7 +45,8 @@ public function testEventSetResponse() { $event = new FormActionEvent( $this->createMock(FormInterface::class), - new stdClass(), 'fooButton' + new stdClass(), + 'fooButton' ); self::assertFalse($event->hasResponse()); self::assertNull($event->getResponse()); @@ -62,7 +64,9 @@ public function testGetOption() $event = new FormActionEvent( $this->createMock(FormInterface::class), - new stdClass(), 'fooButton', $options + new stdClass(), + 'fooButton', + $options ); self::assertTrue($event->hasOption('languageCode')); self::assertTrue($event->hasOption('foo')); @@ -72,3 +76,5 @@ public function testGetOption() self::assertSame($objectOption, $event->getOption('obj')); } } + +class_alias(FormActionEventTest::class, 'EzSystems\EzPlatformContentForms\Tests\Event\FormActionEventTest'); diff --git a/src/lib/Tests/FieldType/DataTransformer/FieldValueTransformerTest.php b/tests/lib/FieldType/DataTransformer/FieldValueTransformerTest.php similarity index 83% rename from src/lib/Tests/FieldType/DataTransformer/FieldValueTransformerTest.php rename to tests/lib/FieldType/DataTransformer/FieldValueTransformerTest.php index b87ea01c..3e328e8f 100644 --- a/src/lib/Tests/FieldType/DataTransformer/FieldValueTransformerTest.php +++ b/tests/lib/FieldType/DataTransformer/FieldValueTransformerTest.php @@ -1,16 +1,16 @@ assertSame($expected, $result); } } + +class_alias(FieldValueTransformerTest::class, 'EzSystems\EzPlatformContentForms\Tests\FieldType\DataTransformer\FieldValueTransformerTest'); diff --git a/src/lib/Tests/FieldType/DataTransformer/MultiSelectionValueTransformerTest.php b/tests/lib/FieldType/DataTransformer/MultiSelectionValueTransformerTest.php similarity index 80% rename from src/lib/Tests/FieldType/DataTransformer/MultiSelectionValueTransformerTest.php rename to tests/lib/FieldType/DataTransformer/MultiSelectionValueTransformerTest.php index 6b52070b..809c0ae0 100644 --- a/src/lib/Tests/FieldType/DataTransformer/MultiSelectionValueTransformerTest.php +++ b/tests/lib/FieldType/DataTransformer/MultiSelectionValueTransformerTest.php @@ -1,15 +1,15 @@ reverseTransform(null)); } } + +class_alias(MultiSelectionValueTransformerTest::class, 'EzSystems\EzPlatformContentForms\Tests\FieldType\DataTransformer\MultiSelectionValueTransformerTest'); diff --git a/src/lib/Tests/FieldType/DataTransformer/MultipleCountryValueTransformerTest.php b/tests/lib/FieldType/DataTransformer/MultipleCountryValueTransformerTest.php similarity index 90% rename from src/lib/Tests/FieldType/DataTransformer/MultipleCountryValueTransformerTest.php rename to tests/lib/FieldType/DataTransformer/MultipleCountryValueTransformerTest.php index 9bc1d4ee..bbe080e3 100644 --- a/src/lib/Tests/FieldType/DataTransformer/MultipleCountryValueTransformerTest.php +++ b/tests/lib/FieldType/DataTransformer/MultipleCountryValueTransformerTest.php @@ -1,21 +1,21 @@ ['Name' => 'Afghanistan', 'Alpha2' => 'AF', 'Alpha3' => 'AFG', 'IDC' => '93'], @@ -103,7 +103,7 @@ public function reverseTransformNullProvider() [42], ['snafu'], [null], - [new \eZ\Publish\Core\FieldType\Country\Value()], + [new \Ibexa\Core\FieldType\Country\Value()], ]; } @@ -116,3 +116,5 @@ public function testReverseTransformNull($value) self::assertNull($transformer->reverseTransform($value)); } } + +class_alias(MultipleCountryValueTransformerTest::class, 'EzSystems\EzPlatformContentForms\Tests\FieldType\DataTransformer\MultipleCountryValueTransformerTest'); diff --git a/src/lib/Tests/FieldType/DataTransformer/RelationListValueTransformerTest.php b/tests/lib/FieldType/DataTransformer/RelationListValueTransformerTest.php similarity index 68% rename from src/lib/Tests/FieldType/DataTransformer/RelationListValueTransformerTest.php rename to tests/lib/FieldType/DataTransformer/RelationListValueTransformerTest.php index 7342989f..cfa50454 100644 --- a/src/lib/Tests/FieldType/DataTransformer/RelationListValueTransformerTest.php +++ b/tests/lib/FieldType/DataTransformer/RelationListValueTransformerTest.php @@ -1,15 +1,15 @@ reverseTransform(null)); } } + +class_alias(SingleSelectionValueTransformerTest::class, 'EzSystems\EzPlatformContentForms\Tests\FieldType\DataTransformer\SingleSelectionValueTransformerTest'); diff --git a/src/lib/Tests/FieldType/DataTransformer/TimeValueTransformerTest.php b/tests/lib/FieldType/DataTransformer/TimeValueTransformerTest.php similarity index 77% rename from src/lib/Tests/FieldType/DataTransformer/TimeValueTransformerTest.php rename to tests/lib/FieldType/DataTransformer/TimeValueTransformerTest.php index a677e7f8..ba1311d3 100644 --- a/src/lib/Tests/FieldType/DataTransformer/TimeValueTransformerTest.php +++ b/tests/lib/FieldType/DataTransformer/TimeValueTransformerTest.php @@ -1,18 +1,18 @@ transform((object) ['time' => 1]); } } + +class_alias(TimeValueTransformerTest::class, 'EzSystems\EzPlatformContentForms\Tests\FieldType\DataTransformer\TimeValueTransformerTest'); diff --git a/src/lib/Tests/FieldType/FieldTypeFormMapperDispatcherTest.php b/tests/lib/FieldType/FieldTypeFormMapperDispatcherTest.php similarity index 60% rename from src/lib/Tests/FieldType/FieldTypeFormMapperDispatcherTest.php rename to tests/lib/FieldType/FieldTypeFormMapperDispatcherTest.php index bfec8272..207550e3 100644 --- a/src/lib/Tests/FieldType/FieldTypeFormMapperDispatcherTest.php +++ b/tests/lib/FieldType/FieldTypeFormMapperDispatcherTest.php @@ -1,27 +1,27 @@ dispatcher->map($formMock, $data); } } + +class_alias(FieldTypeFormMapperDispatcherTest::class, 'EzSystems\EzPlatformContentForms\Tests\FieldType\FieldTypeFormMapperDispatcherTest'); diff --git a/src/lib/Tests/FieldType/Mapper/BaseMapperTest.php b/tests/lib/FieldType/Mapper/BaseMapperTest.php similarity index 84% rename from src/lib/Tests/FieldType/Mapper/BaseMapperTest.php rename to tests/lib/FieldType/Mapper/BaseMapperTest.php index 9e43bd89..987429a6 100644 --- a/src/lib/Tests/FieldType/Mapper/BaseMapperTest.php +++ b/tests/lib/FieldType/Mapper/BaseMapperTest.php @@ -1,16 +1,16 @@ getMock(); } } + +class_alias(BaseMapperTest::class, 'EzSystems\EzPlatformContentForms\Tests\FieldType\Mapper\BaseMapperTest'); diff --git a/src/lib/Tests/FieldType/Mapper/FormTypeBasedFieldValueFormMapperTest.php b/tests/lib/FieldType/Mapper/FormTypeBasedFieldValueFormMapperTest.php similarity index 81% rename from src/lib/Tests/FieldType/Mapper/FormTypeBasedFieldValueFormMapperTest.php rename to tests/lib/FieldType/Mapper/FormTypeBasedFieldValueFormMapperTest.php index f16ca67e..afd84ead 100644 --- a/src/lib/Tests/FieldType/Mapper/FormTypeBasedFieldValueFormMapperTest.php +++ b/tests/lib/FieldType/Mapper/FormTypeBasedFieldValueFormMapperTest.php @@ -1,15 +1,15 @@ mapFieldValueForm($this->fieldForm, $this->data); } } + +class_alias(FormTypeBasedFieldValueFormMapperTest::class, 'EzSystems\EzPlatformContentForms\Tests\FieldType\Mapper\FormTypeBasedFieldValueFormMapperTest'); diff --git a/src/lib/Tests/FieldType/Mapper/UserAccountFieldValueFormMapperTest.php b/tests/lib/FieldType/Mapper/UserAccountFieldValueFormMapperTest.php similarity index 81% rename from src/lib/Tests/FieldType/Mapper/UserAccountFieldValueFormMapperTest.php rename to tests/lib/FieldType/Mapper/UserAccountFieldValueFormMapperTest.php index fe533729..17771e14 100644 --- a/src/lib/Tests/FieldType/Mapper/UserAccountFieldValueFormMapperTest.php +++ b/tests/lib/FieldType/Mapper/UserAccountFieldValueFormMapperTest.php @@ -1,17 +1,17 @@ mapFieldValueForm($this->fieldForm, $this->data); } } + +class_alias(UserAccountFieldValueFormMapperTest::class, 'EzSystems\EzPlatformContentForms\Tests\FieldType\Mapper\UserAccountFieldValueFormMapperTest'); diff --git a/src/lib/Tests/Validator/Constraints/FieldValueTest.php b/tests/lib/Validator/Constraints/FieldValueTest.php similarity index 61% rename from src/lib/Tests/Validator/Constraints/FieldValueTest.php rename to tests/lib/Validator/Constraints/FieldValueTest.php index f93a4ae0..9a682199 100644 --- a/src/lib/Tests/Validator/Constraints/FieldValueTest.php +++ b/tests/lib/Validator/Constraints/FieldValueTest.php @@ -1,14 +1,15 @@ validatedBy()); + self::assertSame(FieldValueValidator::class, $constraint->validatedBy()); } public function testGetTargets() @@ -32,3 +33,5 @@ public function testGetTargets() self::assertSame(Constraint::CLASS_CONSTRAINT, $constraint->getTargets()); } } + +class_alias(FieldValueTest::class, 'EzSystems\EzPlatformContentForms\Tests\Validator\Constraints\FieldValueTest'); diff --git a/src/lib/Tests/Validator/Constraints/PasswordTest.php b/tests/lib/Validator/Constraints/PasswordTest.php similarity index 65% rename from src/lib/Tests/Validator/Constraints/PasswordTest.php rename to tests/lib/Validator/Constraints/PasswordTest.php index eeffa42e..fcb895c7 100644 --- a/src/lib/Tests/Validator/Constraints/PasswordTest.php +++ b/tests/lib/Validator/Constraints/PasswordTest.php @@ -1,20 +1,20 @@ assertSame([Password::CLASS_CONSTRAINT, Password::PROPERTY_CONSTRAINT], $this->constraint->getTargets()); } } + +class_alias(PasswordTest::class, 'EzSystems\EzPlatformContentForms\Tests\Validator\Constraints\PasswordTest'); diff --git a/src/lib/Tests/Validator/Constraints/PasswordValidatorTest.php b/tests/lib/Validator/Constraints/PasswordValidatorTest.php similarity index 84% rename from src/lib/Tests/Validator/Constraints/PasswordValidatorTest.php rename to tests/lib/Validator/Constraints/PasswordValidatorTest.php index 868c95c4..ac57745c 100644 --- a/src/lib/Tests/Validator/Constraints/PasswordValidatorTest.php +++ b/tests/lib/Validator/Constraints/PasswordValidatorTest.php @@ -1,32 +1,32 @@ assertSame([UserAccountPassword::CLASS_CONSTRAINT, UserAccountPassword::PROPERTY_CONSTRAINT], $this->constraint->getTargets()); } } + +class_alias(UserAccountPasswordTest::class, 'EzSystems\EzPlatformContentForms\Tests\Validator\Constraints\UserAccountPasswordTest'); diff --git a/src/lib/Tests/Validator/Constraints/UserAccountPasswordValidatorTest.php b/tests/lib/Validator/Constraints/UserAccountPasswordValidatorTest.php similarity index 82% rename from src/lib/Tests/Validator/Constraints/UserAccountPasswordValidatorTest.php rename to tests/lib/Validator/Constraints/UserAccountPasswordValidatorTest.php index 643c6c54..426eae92 100644 --- a/src/lib/Tests/Validator/Constraints/UserAccountPasswordValidatorTest.php +++ b/tests/lib/Validator/Constraints/UserAccountPasswordValidatorTest.php @@ -1,33 +1,33 @@ createMock(ContentType::class); $this->userService @@ -91,7 +91,7 @@ public function testValid() public function testInvalid() { $contentType = $this->createMock(ContentType::class); - $userAccount = new UserAccountFieldData('user', 'pass', 'user@ez.no'); + $userAccount = new UserAccountFieldData('user', 'pass', 'user@ibexa.co'); $errorParameter = 'foo'; $errorMessage = 'error'; @@ -133,3 +133,5 @@ public function testInvalid() ])); } } + +class_alias(UserAccountPasswordValidatorTest::class, 'EzSystems\EzPlatformContentForms\Tests\Validator\Constraints\UserAccountPasswordValidatorTest');