<?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 Customize\Form\Type;
use Eccube\Common\EccubeConfig;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Validator\Constraints\Regex;
use Symfony\Component\Validator\Constraints\Blank;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
use Symfony\Component\Validator\Constraints\GreaterThanOrEqual;
class OrderDetailsBlockType extends AbstractType
{
/**
* @var EccubeConfig
*/
protected $eccubeConfig;
/**
* EntryProductBlockType constructor.
*
* @param EccubeConfig $eccubeConfig
*/
public function __construct(EccubeConfig $eccubeConfig)
{
$this->eccubeConfig = $eccubeConfig;
}
/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
for ($i = 1; $i < 9; $i++) {
// code...
$builder
->add("product_code{$i}", TextType::class, [
'required' => false,
])
->add("product_name{$i}", TextType::class, [
'required' => false,
])
->add("quantity{$i}", IntegerType::class, [
'constraints' => [
new Regex(['pattern' => '/^\d+$/']),
],
])
->add("print{$i}", ChoiceType::class, [
'choices' => array(
'無し' => '無し',
'有り' => '有り',
),
])
->add("han{$i}", ChoiceType::class, [
'choices' => array(
'新規・改版' => '新規・改版',
'前回通り' => '前回通り',
),
])
->add("color{$i}", ChoiceType::class, [
'choices' => array(
'金' => '金',
'銀' => '銀',
'黒' => '黒',
'白' => '白',
'赤' => '赤',
'紺' => '紺',
'黄' => '黄',
'緑' => '緑',
),
]);
}
}
/**
* {@inheritdoc}
*/
public function getBlockPrefix()
{
return 'order_detail_block';
}
}