バージョン選択

フォーラム

メニュー

オンライン状況

36 人のユーザが現在オンラインです。 (30 人のユーザが フォーラム を参照しています。)
登録ユーザ: 0
ゲスト: 36
もっと...

サイト内検索

プラグイン > その他 > お問い合わせフォーム追加

その他

新規スレッドを追加する

フラット表示 前のトピック | 次のトピック
投稿者 スレッド
tkm12121
投稿日時: 2020/4/28 17:18
対応状況: 確認中
半人前
登録日: 2020/3/19
居住地:
投稿: 13
お問い合わせフォーム追加
お問い合わせフォームを複製して作成を致しましたが、元々ある「お問い合わせフォーム」の確認ページへ移行できない状況です。

「新しく追加したフォーム」は確認・完了まで表示されます。

【src >> Eccube >> Form >> Type >> Front >>ContactType.php】にコード追加と
【src >>Eccube >>Form >>Type >>ChoiceType.php】を追加したところ、確認ページへ移行できなくなってしまいます。両方を削除すると元に戻ります。

恐れ入りますが、よろしくお願いいたします。

―――――――――――――――――

【ContactType.php追加内容】

use Symfony\Component\Form\Extension\Core\Type\ChoiceType;




$Selection = ['見積依頼' => '見積依頼','価格に関して' => '価格に関して','商品に関して' => '商品に関して','その他' => 'その他'];
$builder
->add('how', ChoiceType::class, [
'required' => true,
'choices' => $Selection,
'multiple' => false,
'expanded' => false,
'mapped' => true,
'placeholder' => '選択してください ▼',
'constraints' => [
new Assert\NotBlank(),
],
])

―――――――――――――――――


[src >>Eccube >>Form >>Type >>ChoiceType.php]へ追加


<?php

/*
* This file is part of EC-CUBE
*
* Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
*
* http://www.ec-cube.co.jp/
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Eccube\Form\Type;

use Eccube\Common\EccubeConfig;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Validator\Constraints as Assert;

class ChoiceType extends AbstractType
{
/**
* @var EccubeConfig
*/
protected $eccubeConfig;

/**
* ChoiceType constructor.
*
* @param EccubeConfig $eccubeConfig
*/
public function __construct(
EccubeConfig $eccubeConfig
) {
$this->eccubeConfig = $eccubeConfig;
}

/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$options['how_options']['required'] = $options['required'];

// required の場合は NotBlank も追加する
if ($options['required']) {
$options['how_options']['constraints'] = array_merge([
new Assert\NotBlank(),
], $options['how_options']['constraints']);
}

if (!isset($options['options']['error_bubbling'])) {
$options['options']['error_bubbling'] = $options['error_bubbling'];
}

if (empty($options['how'])) {
$options['how'] = $builder->getHow();
}

$builder
->add($options['how'], TextType::class, array_merge_recursive($options['options'], $options['how_options']))
;

$builder->setAttribute('how', $options['how']);
$builder->setAttribute('how', $options['how']);
}

/**
* {@inheritdoc}
*/
public function buildView(FormView $view, FormInterface $form, array $options)
{
$builder = $form->getConfig();
$view->vars['how'] = $builder->getAttribute('how');
}

/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'options' => [],
'how_options' => [
'attr' => [
'placeholder' => 'common.how',
],
'constraints' => [
new Assert\Length([
'max' => $this->eccubeConfig['eccube_name_len'],
]),
new Assert\Regex([
'pattern' => '/^[^\s ]+$/u',
'message' => 'form_error.not_contain_spaces',
]),
],
],
'how' => '',
'error_bubbling' => false,
'inherit_data' => true,
'trim' => true,
]);
}

/**
* {@inheritdoc}
*/
public function getBlockPrefix()
{
return 'how';
}
}

フラット表示 前のトピック | 次のトピック


題名 投稿者 日時
 » お問い合わせフォーム追加 tkm12121 2020/4/28 17:18
     Re: お問い合わせフォーム追加 468 2020/4/28 18:23
       Re: お問い合わせフォーム追加 tkm12121 2020/4/28 19:05
         Re: お問い合わせフォーム追加 468 2020/4/29 12:06
           Re: お問い合わせフォーム追加 tkm12121 2020/4/30 10:00

 



ログイン


EC-CUBE公式 Amazon Payプラグイン

統計情報

総メンバー数は88,967名です
総投稿数は110,019件です

投稿数ランキング

1
seasoft
7367
2
468
3217
3
AMUAMU
2712
4
nanasess
2314
5
umebius
2085
6
yuh
1819
7
h_tanaka
1646
8
red
1570
9
mcontact
1296
10
tsuji
958
11
fukap
907
12
shutta
835
13
tao_s
799
14 ramrun 789
15 karin 689
16 sumida 641
17
homan
633
18 DELIGHT 572
19
patapata
502
20
flealog
485


ネットショップの壺

EC-CUBEインテグレートパートナー

Copyright© EC-CUBE CO.,LTD. All Rights Reserved.