Setting creation form language
This commit is contained in:
@@ -103,6 +103,8 @@
|
|||||||
<form name="thelia.admin.country.modification" class="Thelia\Form\CountryModificationForm"/>
|
<form name="thelia.admin.country.modification" class="Thelia\Form\CountryModificationForm"/>
|
||||||
|
|
||||||
<form name="thelia.admin.profile.modification" class="Thelia\Form\ProfileModificationForm"/>
|
<form name="thelia.admin.profile.modification" class="Thelia\Form\ProfileModificationForm"/>
|
||||||
|
|
||||||
|
<form name="thelia.admin.language.creation" class="Thelia\Form\LanguageCreationForm"/>
|
||||||
|
|
||||||
</forms>
|
</forms>
|
||||||
|
|
||||||
|
|||||||
58
core/lib/Thelia/Form/LanguageCreationForm.php
Normal file
58
core/lib/Thelia/Form/LanguageCreationForm.php
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
<?php
|
||||||
|
/*************************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* Thelia */
|
||||||
|
/* */
|
||||||
|
/* Copyright (c) OpenStudio */
|
||||||
|
/* email : info@thelia.net */
|
||||||
|
/* web : http://www.thelia.net */
|
||||||
|
/* */
|
||||||
|
/* This program is free software; you can redistribute it and/or modify */
|
||||||
|
/* it under the terms of the GNU General Public License as published by */
|
||||||
|
/* the Free Software Foundation; either version 3 of the License */
|
||||||
|
/* */
|
||||||
|
/* This program is distributed in the hope that it will be useful, */
|
||||||
|
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||||
|
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||||
|
/* GNU General Public License for more details. */
|
||||||
|
/* */
|
||||||
|
/* You should have received a copy of the GNU General Public License */
|
||||||
|
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
/* */
|
||||||
|
/*************************************************************************************/
|
||||||
|
namespace Thelia\Form;
|
||||||
|
|
||||||
|
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||||
|
use Thelia\Core\Translation\Translator;
|
||||||
|
|
||||||
|
class LanguageCreationForm extends BaseForm
|
||||||
|
{
|
||||||
|
protected function buildForm()
|
||||||
|
{
|
||||||
|
$this->formBuilder
|
||||||
|
->add("title", "text", array(
|
||||||
|
"constraints" => array(
|
||||||
|
new NotBlank()
|
||||||
|
),
|
||||||
|
"label" => Translator::getInstance()->trans("Language title *"),
|
||||||
|
"label_attr" => array(
|
||||||
|
"for" => "title"
|
||||||
|
)
|
||||||
|
))
|
||||||
|
->add("isocode", "text", array(
|
||||||
|
"constraints" => array(
|
||||||
|
new NotBlank()
|
||||||
|
),
|
||||||
|
"label" => Translator::getInstance()->trans("ISO Code *"),
|
||||||
|
"label_attr" => array(
|
||||||
|
"for" => "isocode"
|
||||||
|
)
|
||||||
|
))
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getName()
|
||||||
|
{
|
||||||
|
return "thelia_language_creation";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -180,10 +180,58 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{form name="thelia.admin.language.creation"}
|
||||||
|
|
||||||
|
{* Capture the dialog body, to pass it to the generic dialog *}
|
||||||
|
{capture "creation_dialog"}
|
||||||
|
|
||||||
|
{form_hidden_fields form=$form}
|
||||||
|
|
||||||
|
{* Be sure to get the language_id, even if the form could not be validated *}
|
||||||
|
<input type="hidden" name="language_id" value="{$language_id}" />
|
||||||
|
|
||||||
|
{form_field form=$form field='success_url'}
|
||||||
|
{* on success, redirect to the edition page, _ID_ is replaced with the created object ID, see controller *}
|
||||||
|
<input type="hidden" name="{$name}" value="{url path='/admin/configuration/languages/update' language_id='_ID_'}" />
|
||||||
|
{/form_field}
|
||||||
|
|
||||||
|
{form_field form=$form field='title'}
|
||||||
|
<div class="form-group {if $error}has-error{/if}">
|
||||||
|
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||||
|
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{intl l="{$label}"}" placeholder="{intl l='Language title'}">
|
||||||
|
</div>
|
||||||
|
{/form_field}
|
||||||
|
|
||||||
|
{form_field form=$form field='isocode'}
|
||||||
|
<div class="form-group {if $error}has-error{/if}">
|
||||||
|
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||||
|
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{intl l="{$label}"}" placeholder="{intl l='ISO Code'}">
|
||||||
|
</div>
|
||||||
|
{/form_field}
|
||||||
|
|
||||||
|
{module_include location='language_create_form'}
|
||||||
|
|
||||||
|
{/capture}
|
||||||
|
|
||||||
|
{include
|
||||||
|
file = "includes/generic-create-dialog.html"
|
||||||
|
|
||||||
|
dialog_id = "creation_dialog"
|
||||||
|
dialog_title = {intl l="Create a new language"}
|
||||||
|
dialog_body = {$smarty.capture.creation_dialog nofilter}
|
||||||
|
|
||||||
|
dialog_ok_label = {intl l="Create this language"}
|
||||||
|
|
||||||
|
form_action = {url path='/admin/configuration/languages/create'}
|
||||||
|
form_enctype = {form_enctype form=$form}
|
||||||
|
form_error_message = $form_error_message
|
||||||
|
}
|
||||||
|
{/form}
|
||||||
|
|
||||||
{* Delete confirmation dialog *}
|
{* Delete confirmation dialog *}
|
||||||
|
|
||||||
{capture "delete_dialog"}
|
{capture "delete_dialog"}
|
||||||
<input type="hidden" name="message_id" id="message_delete_id" value="" />
|
<input type="hidden" name="message_id" id="language_delete_id" value="" />
|
||||||
|
|
||||||
{module_include location='languages_delete_form'}
|
{module_include location='languages_delete_form'}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user