質問 > フロント機能 > 新規会員登録のRepeatedTypeを辞めたい |
フロント機能
フラット表示 | 前のトピック | 次のトピック |
投稿者 | スレッド |
---|---|
toku3 |
投稿日時: 2024/2/15 18:42
対応状況: −−−
|
新米 登録日: 2024/2/15 居住地: 投稿: 3 |
新規会員登録のRepeatedTypeを辞めたい [EC-CUBE] eccube-4.2.3 新規
[レンタルサーバ] localhost [OS] Windows 11 Pro [PHP] PHP 8.1.25 (cli) [データベース] Mysql8.0.35 [WEBサーバ] Apache/2.4.58 [ブラウザ] Google Chrome121.0.6167.185 [導入プラグインの有無] 無 [カスタマイズの有無] <?php namespace Customize\Form\Extension; use Eccube\Common\EccubeConfig; use Eccube\Form\Type\Front\EntryType; use Eccube\Form\Type\Master\JobType; use Eccube\Form\Validator\Email; use Symfony\Component\Form\AbstractTypeExtension; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\Extension\Core\DataTransformer\ValueToDuplicatesTransformer; use Symfony\Component\Form\Extension\Core\Type\EmailType; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Validator\Constraints as Assert; class EntryFormExtension extends AbstractTypeExtension { public static function getExtendedTypes(): iterable { yield EntryType::class; } /** * @var EccubeConfig */ protected $eccubeConfig; /** * EntryFormExtension constructor. * * @param EccubeConfig $eccubeConfig */ public function __construct(EccubeConfig $eccubeConfig) { $this->eccubeConfig = $eccubeConfig; } /** * {@inheritdoc} */ public function buildForm(FormBuilderInterface $builder, array $options) { $this->typeChange($builder); } private function typeChange(FormBuilderInterface $builder) { $builder ->remove('email') ->add('email', EmailType::class, [ 'required' => true, 'constraints' => [ new Assert\NotBlank(), new Email(null, null, $this->eccubeConfig['eccube_rfc_email_check'] ? 'strict' : null), ], 'attr' => [ 'placeholder' => 'common.mail_address_sample', ], ]) ->remove('plain_password') ->add('plain_password', TextType::class, [ 'required' => true, 'constraints' => [ new Assert\Length([ 'min' => $this->eccubeConfig['eccube_password_min_len'], 'max' => $this->eccubeConfig['eccube_password_max_len'], ]), new Assert\Regex([ 'pattern' => $this->eccubeConfig['eccube_password_pattern'], 'message' => 'form_error.password_pattern_invalid', ]), ], 'attr' => [ 'placeholder' => trans('common.password_sample', [ '%min%' => $this->eccubeConfig['eccube_password_min_len'], '%max%' => $this->eccubeConfig['eccube_password_max_len'], ]), ], ]); } } [現象] ファイルをそのまま載せてすみません。 新規会員登録のメールアドレスとパスワードの入力を1回で済むように変更中です。 現在、Extensionを利用して removeで一旦消して、addで新たに作り直してみました。 'email'だけの場合は、表示上うまく行っているようです。(登録の動作確認はしていません。) ところが、'plain_password'で同じことをすると 「システムエラーが発生しました。大変お手数ですが、サイト管理者までご連絡ください。」 になってしまいます。 この考え方ではうまく行かないのか、別のファイルも変更する必要があるのか 何かアドバイスを頂けると幸いです。 |
フラット表示 | 前のトピック | 次のトピック |
題名 | 投稿者 | 日時 |
---|---|---|
» 新規会員登録のRepeatedTypeを辞めたい | toku3 | 2024/2/15 18:42 |
Re: 新規会員登録のRepeatedTypeを辞めたい | mcontact | 2024/2/15 18:52 |
Re: 新規会員登録のRepeatedTypeを辞めたい | toku3 | 2024/2/15 20:06 |
Re: 新規会員登録のRepeatedTypeを辞めたい | tattsu | 2024/2/15 20:40 |
Re: 新規会員登録のRepeatedTypeを辞めたい | toku3 | 2024/2/15 21:31 |