allow intl for document object

This commit is contained in:
Manuel Raynaud
2014-02-10 12:04:03 +01:00
parent b9575432fd
commit e4916e5198
3 changed files with 27 additions and 13 deletions

View File

@@ -860,7 +860,7 @@ class FileController extends BaseAdminController
protected function createDocumentEventInstance($parentType, $model, $data) protected function createDocumentEventInstance($parentType, $model, $data)
{ {
$documentCreateEvent = new DocumentCreateOrUpdateEvent($parentType, null); $documentCreateEvent = new DocumentCreateOrUpdateEvent($parentType, null);
$model->setLocale($data['locale']);
if (isset($data['title'])) { if (isset($data['title'])) {
$model->setTitle($data['title']); $model->setTitle($data['title']);
} }

View File

@@ -122,6 +122,13 @@ abstract class DocumentModification extends BaseForm
) )
) )
) )
->add("locale", "text", array(
"constraints" => array(
new NotBlank()
),
"label_attr" => array("for" => "locale_create")
))
; ;
} }
} }

View File

@@ -30,12 +30,13 @@
{form name="$formId"} {form name="$formId"}
<form method="POST" action="{url path="/admin/document/type/{$documentType}/{$ID}/update"}" enctype="multipart/form-data" class="clearfix"> <form method="POST" action="{url path="/admin/document/type/{$documentType}/{$ID}/update"}" enctype="multipart/form-data" class="clearfix">
<div class="row inner-toolbar clearfix"> {include
<div class="col-md-6 inner-actions pull-right"> file = "includes/inner-form-toolbar.html"
<a href="{url path="{$redirectUrl}"}" class="btn btn-default btn-info">{intl l='Back'} <span class="glyphicon glyphicon-remove"></span></a> hide_submit_buttons = false
<button type="submit" name="save_mode" value="stay" class="btn btn-default btn-primary" title="{intl l='Save'}">{intl l='Save'} <span class="glyphicon glyphicon-ok"></span></button>
</div> page_url = "{url path="/admin/document/type/{$documentType}/{$ID}/update"}"
</div> close_url = "{url path="{$redirectUrl}"}"
}
{form_hidden_fields form=$form} {form_hidden_fields form=$form}
@@ -43,6 +44,10 @@
<input type="hidden" name="{$name}" value="{url path="/admin/document/type/{$documentType}/{$ID}/update"}" /> <input type="hidden" name="{$name}" value="{url path="/admin/document/type/{$documentType}/{$ID}/update"}" />
{/form_field} {/form_field}
{form_field form=$form field='locale'}
<input type="hidden" name="{$name}" value="{$edit_language_locale}" />
{/form_field}
{if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if} {if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}
<p class="title title-without-tabs">{intl l="Document informations"}</p> <p class="title title-without-tabs">{intl l="Document informations"}</p>
@@ -97,12 +102,14 @@
</div> </div>
</div> </div>
<div class="row inner-toolbar clearfix"> {include
<div class="col-md-6 inner-actions pull-right"> file = "includes/inner-form-toolbar.html"
<a href="{url path="{$redirectUrl}"}" class="btn btn-default btn-info">{intl l='Back'} <span class="glyphicon glyphicon-remove"></span></a> hide_submit_buttons = false
<button type="submit" name="save_mode" value="stay" class="btn btn-default btn-primary" title="{intl l='Save'}">{intl l='Save'} <span class="glyphicon glyphicon-ok"></span></button> hide_flags = true
</div>
</div> page_url = "{url path="/admin/document/type/{$documentType}/{$ID}/update"}"
close_url = "{url path="{$redirectUrl}"}"
}
</form> </form>
{/form} {/form}