Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Resources/views/Form/jquery_layout.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,10 @@
<script type="text/javascript">
jQuery(document).ready(function($) {
$field = $('#{{ id }}');
{% if configs.placeholder is defined %}
{% set configs = {'placeholder': configs.placeholder|trans} + configs %}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{% set configs.placeholder = configs.placeholder|trans %}

would be better optmized.
Also a possibility to fetch the translation domain from the form config itself

Copy link

@benschumi benschumi Dec 8, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neirda24, your code doesn't work.

Unexpected token "punctuation" of value "." ("end of statement block" expected) in GenemuFormBundle:Form:jquery_layout.html.twig at line 661.

The original method by jcrombez work well
{% set configs = {'placeholder': configs.placeholder|trans} + configs %}
but i prefer this
{% set configs = configs|merge({"placeholder": configs.placeholder|trans}) %}

{% endif %}
{% block genemu_jqueryselect2_javascript_prototype %}
$field.select2({{ configs|json_encode|raw }});
Expand Down