PointRetrait : création et suppression OK, il reste un peu de boulot sur l'enregistrement.
This commit is contained in:
96
local/modules/PointRetrait/Form/CreateForm.php
Normal file
96
local/modules/PointRetrait/Form/CreateForm.php
Normal file
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
|
||||
namespace PointRetrait\Form;
|
||||
|
||||
use PointRetrait\PointRetrait;
|
||||
use Symfony\Component\Validator\Constraints\GreaterThanOrEqual;
|
||||
use Thelia\Form\BaseForm;
|
||||
use Symfony\Component\Validator\Constraints;
|
||||
|
||||
/**
|
||||
* Class CreateForm
|
||||
* @package PointRetrait\Form
|
||||
*/
|
||||
class CreateForm extends BaseForm
|
||||
{
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function buildForm()
|
||||
{
|
||||
$this->formBuilder
|
||||
->add(
|
||||
"title",
|
||||
"text",
|
||||
[
|
||||
"required" => true,
|
||||
"constraints" => [new Constraints\NotBlank()],
|
||||
"label" => $this->translator->trans('Place name', [], PointRetrait::DOMAIN_NAME),
|
||||
"label_attr" => ['for' => 'title']
|
||||
])
|
||||
->add(
|
||||
"price",
|
||||
"number",
|
||||
[
|
||||
"required" => true,
|
||||
"constraints" => [new GreaterThanOrEqual(["value" => 0])],
|
||||
"label" => $this->translator->trans('Withdrawal price', [], PointRetrait::DOMAIN_NAME),
|
||||
"label_attr" => ['for' => 'price']
|
||||
])
|
||||
->add(
|
||||
"minimum_amount",
|
||||
"number",
|
||||
[
|
||||
"required" => true,
|
||||
"constraints" => [new GreaterThanOrEqual(["value" => 0])],
|
||||
"label" => $this->translator->trans('Minimum amount', [], PointRetrait::DOMAIN_NAME),
|
||||
"label_attr" => ['for' => 'minimum_amount']
|
||||
])
|
||||
->add(
|
||||
"address1","text",
|
||||
[
|
||||
"required" => true,
|
||||
"constraints" => [new Constraints\NotBlank()],
|
||||
"label" => $this->translator->trans('Address1', [], PointRetrait::DOMAIN_NAME),
|
||||
"label_attr" => ['for' => 'address1']
|
||||
])
|
||||
->add(
|
||||
"address2","text",
|
||||
[
|
||||
"required" => false,
|
||||
"label" => $this->translator->trans('Address2', [], PointRetrait::DOMAIN_NAME),
|
||||
"label_attr" => ['for' => 'address2']
|
||||
])
|
||||
->add(
|
||||
"zipcode","text",
|
||||
[
|
||||
"required" => true,
|
||||
"constraints" => [new Constraints\NotBlank()],
|
||||
"label" => $this->translator->trans('Zipcode', [], PointRetrait::DOMAIN_NAME),
|
||||
"label_attr" => ['for' => 'zipcode']
|
||||
])
|
||||
->add(
|
||||
"city","text",
|
||||
[
|
||||
"required" => true,
|
||||
"constraints" => [new Constraints\NotBlank()],
|
||||
"label" => $this->translator->trans('City', [], PointRetrait::DOMAIN_NAME),
|
||||
"label_attr" => ['for' => 'city']
|
||||
])
|
||||
->add(
|
||||
"active",
|
||||
"number",
|
||||
[
|
||||
"required" => true
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return "place_create";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user