Add validation for Store configuration
This commit is contained in:
@@ -23,9 +23,6 @@
|
||||
namespace Thelia\Form;
|
||||
|
||||
use Symfony\Component\Validator\Constraints;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Symfony\Component\Validator\ExecutionContextInterface;
|
||||
use Thelia\Log\Tlog;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
|
||||
class ConfigStoreForm extends BaseForm
|
||||
@@ -34,12 +31,19 @@ class ConfigStoreForm extends BaseForm
|
||||
{
|
||||
$this->formBuilder
|
||||
->add("store_name", "text", array(
|
||||
"constraints" => array(
|
||||
new Constraints\NotBlank()
|
||||
),
|
||||
"label" => Translator::getInstance()->trans('Store name'),
|
||||
"label_attr" => array(
|
||||
"for" => "store_name"
|
||||
)
|
||||
))
|
||||
->add("store_email", "text", array(
|
||||
"constraints" => array(
|
||||
new Constraints\NotBlank(),
|
||||
new Constraints\Email()
|
||||
),
|
||||
"label" => Translator::getInstance()->trans('Store email address'),
|
||||
"label_attr" => array(
|
||||
"for" => "store_email"
|
||||
@@ -49,40 +53,45 @@ class ConfigStoreForm extends BaseForm
|
||||
"label" => Translator::getInstance()->trans('Business ID'),
|
||||
"label_attr" => array(
|
||||
"for" => "store_business_id"
|
||||
)
|
||||
),
|
||||
"required" => false
|
||||
))
|
||||
->add("store_phone", "text", array(
|
||||
"label" => Translator::getInstance()->trans("Phone"),
|
||||
"label_attr" => array(
|
||||
"for" => "store_phone"
|
||||
)
|
||||
),
|
||||
"required" => false
|
||||
))
|
||||
->add("store_fax", "text", array(
|
||||
"label" => Translator::getInstance()->trans("Fax"),
|
||||
"label_attr" => array(
|
||||
"for" => "store_fax"
|
||||
)
|
||||
),
|
||||
"required" => false
|
||||
))
|
||||
->add("store_address1", "text", array(
|
||||
"constraints" => array(
|
||||
new Constraints\NotBlank()
|
||||
),
|
||||
"label" => Translator::getInstance()->trans("Street Address"),
|
||||
"label_attr" => array(
|
||||
"for" => "store_address1"
|
||||
),
|
||||
"label" => Translator::getInstance()->trans("Street Address ")
|
||||
)
|
||||
))
|
||||
->add("store_address2", "text", array(
|
||||
"label" => Translator::getInstance()->trans("Address Line 2"),
|
||||
"label_attr" => array(
|
||||
"for" => "store_address2"
|
||||
)
|
||||
),
|
||||
"required" => false
|
||||
))
|
||||
->add("store_address3", "text", array(
|
||||
"label" => Translator::getInstance()->trans("Address Line 3"),
|
||||
"label_attr" => array(
|
||||
"for" => "store_address3"
|
||||
)
|
||||
),
|
||||
"required" => false
|
||||
))
|
||||
->add("store_zipcode", "text", array(
|
||||
"constraints" => array(
|
||||
|
||||
@@ -50,50 +50,50 @@
|
||||
<fieldset>
|
||||
{form_field form=$form field='store_name'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label}: </label>
|
||||
<label for="{$label_attr.for}" class="control-label">{$label}:{if $required} <span class="required">*</span>{/if}</label>
|
||||
|
||||
<div class="form-group">
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Used in your store front'}">
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}"{if $required} aria-required="true" required{/if} title="{$label}" placeholder="{intl l='Used in your store front'}">
|
||||
</div>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='store_business_id'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label}: </label>
|
||||
<label for="{$label_attr.for}" class="control-label">{$label}:{if $required} <span class="required">*</span>{/if}</label>
|
||||
|
||||
<div class="form-group">
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Store Business Identification Number (SIRET, etc).'}">
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}"{if $required} aria-required="true" required{/if} title="{$label}" placeholder="{intl l='Store Business Identification Number (SIRET, etc).'}">
|
||||
</div>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='store_email'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label}: </label>
|
||||
<label for="{$label_attr.for}" class="control-label">{$label}:{if $required} <span class="required">*</span>{/if}</label>
|
||||
|
||||
<div class="form-group">
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Email used when you send an email to your customers (Order confirmations, etc).'}">
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}"{if $required} aria-required="true" required{/if} title="{$label}" placeholder="{intl l='Email used when you send an email to your customers (Order confirmations, etc).'}">
|
||||
</div>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='store_phone'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label}: </label>
|
||||
<label for="{$label_attr.for}" class="control-label">{$label}:{if $required} <span class="required">*</span>{/if}</label>
|
||||
|
||||
<div class="form-group">
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l=''}">
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}"{if $required} aria-required="true" required{/if} title="{$label}" placeholder="{intl l=''}">
|
||||
</div>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='store_fax'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label}: </label>
|
||||
<label for="{$label_attr.for}" class="control-label">{$label}:{if $required} <span class="required">*</span>{/if}</label>
|
||||
|
||||
<div class="form-group">
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l=''}">
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}"{if $required} aria-required="true" required{/if} title="{$label}" placeholder="{intl l=''}">
|
||||
</div>
|
||||
</div>
|
||||
{/form_field}
|
||||
@@ -104,41 +104,41 @@
|
||||
|
||||
{form_field form=$form field='store_address1'}
|
||||
<div style="margin-bottom: 5px" class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label}{if $required} <span class="required">*</span>{/if} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Address'}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label}:{if $required} <span class="required">*</span>{/if}</label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}"{if $required} aria-required="true" required{/if} title="{$label}" placeholder="{intl l='Address'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='store_address2'}
|
||||
<div style="margin-bottom: 5px" class="form-group">
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Additional address'}">
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}"{if $required} aria-required="true" required{/if} title="{$label}" placeholder="{intl l='Additional address'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='store_address3'}
|
||||
<div class="form-group">
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Additional address'}">
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}"{if $required} aria-required="true" required{/if} title="{$label}" placeholder="{intl l='Additional address'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='store_zipcode'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label}{if $required} <span class="required">*</span>{/if} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Zip code'}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label}:{if $required} <span class="required">*</span>{/if} </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}"{if $required} aria-required="true" required{/if} title="{$label}" placeholder="{intl l='Zip code'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='store_city'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label}{if $required} <span class="required">*</span>{/if} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='City'}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label}:{if $required} <span class="required">*</span>{/if}</label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}"{if $required} aria-required="true" required{/if} title="{$label}" placeholder="{intl l='City'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='store_country'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label}{if $required} <span class="required">*</span>{/if} : </label>
|
||||
<select name="{$name}" id="{$label_attr.for}" class="form-control">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label}:{if $required} <span class="required">*</span>{/if}</label>
|
||||
<select name="{$name}" id="{$label_attr.for}" class="form-control"{if $required} aria-required="true" required{/if}>
|
||||
{loop type="country" name="country1"}
|
||||
<option value="{$ID}" {if {$value} == $ID}selected{/if}>{$TITLE}</option>
|
||||
{/loop}
|
||||
|
||||
Reference in New Issue
Block a user