diff --git a/src/Sylius/Bundle/AdminBundle/Form/Type/CustomerType.php b/src/Sylius/Bundle/AdminBundle/Form/Type/CustomerType.php index d4ca5b4023..809e26e3bc 100644 --- a/src/Sylius/Bundle/AdminBundle/Form/Type/CustomerType.php +++ b/src/Sylius/Bundle/AdminBundle/Form/Type/CustomerType.php @@ -14,7 +14,6 @@ declare(strict_types=1); namespace Sylius\Bundle\AdminBundle\Form\Type; use Sylius\Bundle\AdminBundle\Form\EventSubscriber\AddUserFormSubscriber; -use Sylius\Bundle\CoreBundle\Form\Type\User\ShopUserType; use Sylius\Bundle\CustomerBundle\Form\Type\CustomerType as BaseCustomerType; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\TextType; diff --git a/src/Sylius/Bundle/AdminBundle/Form/Type/ShopUserType.php b/src/Sylius/Bundle/AdminBundle/Form/Type/ShopUserType.php new file mode 100644 index 0000000000..079d7130e6 --- /dev/null +++ b/src/Sylius/Bundle/AdminBundle/Form/Type/ShopUserType.php @@ -0,0 +1,42 @@ +add('plainPassword', PasswordType::class, [ + 'label' => 'sylius.form.user.password.label', + 'always_empty' => false, + ]) + ; + } + + public function getBlockPrefix(): string + { + return 'sylius_admin_shop_user'; + } + + public function getParent(): string + { + return BaseShopUserType::class; + } +} diff --git a/src/Sylius/Bundle/AdminBundle/Resources/config/app/twig_hooks/customer/create.yaml b/src/Sylius/Bundle/AdminBundle/Resources/config/app/twig_hooks/customer/create.yaml index 271131e7f4..63ed237e2a 100644 --- a/src/Sylius/Bundle/AdminBundle/Resources/config/app/twig_hooks/customer/create.yaml +++ b/src/Sylius/Bundle/AdminBundle/Resources/config/app/twig_hooks/customer/create.yaml @@ -2,7 +2,11 @@ sylius_twig_hooks: hooks: 'sylius_admin.customer.create.content': form: - template: '@SyliusAdmin/shared/crud/common/content/form.html.twig' + component: 'sylius_admin:customer:form' + props: + resource: '@=_context.resource' + form: '@=_context.form' + template: '@SyliusAdmin/shared/crud/common/content/form.html.twig' configuration: render_rest: false priority: 0 diff --git a/src/Sylius/Bundle/AdminBundle/Resources/config/app/twig_hooks/customer/update.yaml b/src/Sylius/Bundle/AdminBundle/Resources/config/app/twig_hooks/customer/update.yaml index 8c0bc42b89..29dd89658d 100644 --- a/src/Sylius/Bundle/AdminBundle/Resources/config/app/twig_hooks/customer/update.yaml +++ b/src/Sylius/Bundle/AdminBundle/Resources/config/app/twig_hooks/customer/update.yaml @@ -2,7 +2,11 @@ sylius_twig_hooks: hooks: 'sylius_admin.customer.update.content': form: - template: '@SyliusAdmin/shared/crud/common/content/form.html.twig' + component: 'sylius_admin:customer:form' + props: + resource: '@=_context.resource' + form: '@=_context.form' + template: '@SyliusAdmin/shared/crud/common/content/form.html.twig' configuration: render_rest: false priority: 0 diff --git a/src/Sylius/Bundle/AdminBundle/Resources/config/services/form.xml b/src/Sylius/Bundle/AdminBundle/Resources/config/services/form.xml index 17d6fa7d5f..f1f76b00eb 100644 --- a/src/Sylius/Bundle/AdminBundle/Resources/config/services/form.xml +++ b/src/Sylius/Bundle/AdminBundle/Resources/config/services/form.xml @@ -253,6 +253,10 @@ + + + + diff --git a/src/Sylius/Bundle/AdminBundle/Resources/config/services/twig/component.xml b/src/Sylius/Bundle/AdminBundle/Resources/config/services/twig/component.xml index 28cac972ff..203e0f2900 100644 --- a/src/Sylius/Bundle/AdminBundle/Resources/config/services/twig/component.xml +++ b/src/Sylius/Bundle/AdminBundle/Resources/config/services/twig/component.xml @@ -77,6 +77,18 @@ + + + + %sylius.model.customer.class% + Sylius\Bundle\AdminBundle\Form\Type\CustomerType + + + + - {% if (hookable_metadata.context.form.vars.value.user is null) %} + {% if (hookable_metadata.context.resource.user.id|default(null) is null) %} {{ 'sylius.ui.account_credentials_details'|trans }}