Skip to content

Commit

Permalink
[Node] Translate form.
Browse files Browse the repository at this point in the history
  • Loading branch information
NoUseFreak committed Apr 6, 2015
1 parent 2157cba commit ff16377
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
{% for child in form if child.vars.tab_type == 'tabs_tab' -%}
<li role="presentation"{% if loop.first %} class="active"{% endif %}>
<a href="#{{ child.vars.id }}" aria-controls="{{ child.vars.id }}" role="tab" data-toggle="tab">
{{ child.vars.label }}
{{ child.vars.label|trans({}, child.vars.translation_domain) }}
</a>
</li>
{%- endfor %}
Expand Down Expand Up @@ -121,7 +121,7 @@
{% block fieldset_widget %}
<fieldset {{ block('widget_container_attributes') }}>
{% if legend is defined and legend is not empty %}
<legend>{{ legend }}</legend>
<legend>{{ legend|trans({}, translation_domain) }}</legend>
{% endif %}
{{ form_widget(form) }}
</fieldset>
Expand Down
21 changes: 12 additions & 9 deletions src/Clastic/NodeBundle/Form/Type/NodeFormType.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,32 +40,34 @@ private function createGeneralTab(FormBuilderInterface $builder)
{
return $this
->createTab($builder, 'general', array(
'label' => 'General',
'label' => 'node.form.tab.general.label',
'position' => 'first',
'translation_domain' => 'clastic',
))
->add('title', 'text', array(
'property_path' => 'node.title',
'label' => 'Title',
'label' => 'node.form.tab.general.field.title',
));
}

private function createPublicationTab(FormBuilderInterface $builder)
{
return $this
->createTab($builder, 'publication', array(
'label' => 'Publication',
'label' => 'node.form.tab.publication.label',
'translation_domain' => 'clastic',
))
->add('available', 'checkbox', array(
'property_path' => 'node.publication.available',
'label' => 'Available',
'label' => 'node.form.tab.publication.field.available',
'required' => false,
))->add('publishedFrom', 'datepicker', array(
'property_path' => 'node.publication.publishedFrom',
'label' => 'From',
'label' => 'node.form.tab.publication.field.published_from',
'required' => false,
))->add('publishedTill', 'datepicker', array(
'property_path' => 'node.publication.publishedTill',
'label' => 'Till',
'label' => 'node.form.tab.publication.field.published_till',
'required' => false,
));
}
Expand All @@ -74,17 +76,18 @@ private function createAuthorInformationTab(FormBuilderInterface $builder)
{
return $this
->createTab($builder, 'author_information', array(
'label' => 'Author information',
'label' => 'node.form.tab.author_information.label',
'translation_domain' => 'clastic',
))
->add('author', 'entity', array(
'class' => 'ClasticUserBundle:User',
'property_path' => 'node.user',
'label' => 'Author',
'label' => 'node.form.tab.author_information.field.author',
'required' => true,
))
->add('created', 'datepicker', array(
'property_path' => 'node.created',
'label' => 'Created',
'label' => 'node.form.tab.author_information.field.created',
'disabled' => true,
));
}
Expand Down
16 changes: 16 additions & 0 deletions src/Clastic/NodeBundle/Resources/translations/clastic.en.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
node.form.tab:
general:
label: Generals
field:
title: Title
publication:
label: Publication
field:
available: Available
published_from: From
published_till: Till
author_information:
label: Author information
field:
author: Author
created: Created

0 comments on commit ff16377

Please sign in to comment.