Fix some mistakes

This commit is contained in:
Mathieu Piot 2018-03-23 10:14:41 +01:00
parent c74e0dc2da
commit d723756331
9 changed files with 50 additions and 32 deletions

View File

@ -34,24 +34,24 @@ col-sm-2
{{- form_help(form) -}}
{{- form_errors(form) -}}
</div>
{##}</div>
</div>
{%- endblock form_row %}
{% block submit_row -%}
<div class="form-group">{#--#}
<div class="{{ block('form_label_class') }}"></div>{#--#}
<div class="form-group">
<div class="{{ block('form_label_class') }}"></div>
<div class="{{ block('form_group_class') }}">
{{- form_widget(form) -}}
</div>{#--#}
</div>
</div>
{%- endblock submit_row %}
{% block reset_row -%}
<div class="form-group">{#--#}
<div class="{{ block('form_label_class') }}"></div>{#--#}
<div class="form-group">
<div class="{{ block('form_label_class') }}"></div>
<div class="{{ block('form_group_class') }}">
{{- form_widget(form) -}}
</div>{#--#}
</div>
</div>
{%- endblock reset_row %}
@ -60,11 +60,11 @@ col-sm-10
{%- endblock form_group_class %}
{% block checkbox_row -%}
<div class="form-group{% if not valid %} has-error{% endif %}">{#--#}
<div class="{{ block('form_label_class') }}"></div>{#--#}
<div class="form-group{% if not valid %} has-error{% endif %}">
<div class="{{ block('form_label_class') }}"></div>
<div class="{{ block('form_group_class') }}">
{{- form_widget(form) -}}
{{- form_errors(form) -}}
</div>{#--#}
</div>
</div>
{%- endblock checkbox_row %}

View File

@ -159,6 +159,12 @@
{% block form_help -%}
{%- if help is not empty -%}
<span id="{{ id }}_help" class="help-block">{{ translation_domain is same as(false) ? help : help|trans({}, translation_domain) }}</span>
<span id="{{ id }}_help" class="help-block">
{%- if translation_domain is same as(false) -%}
{{- help -}}
{%- else -%}
{{- help|trans({}, translation_domain) -}}
{%- endif -%}
</span>
{%- endif -%}
{%- endblock form_help %}

View File

@ -34,7 +34,7 @@ col-sm-2
{{- form_widget(form, widget_attr) -}}
{{- form_help(form) -}}
</div>
{##}</div>
</div>
{%- endif -%}
{%- endblock form_row %}
@ -51,24 +51,24 @@ col-sm-2
{{- form_help(form) -}}
</div>
</div>
{##}</fieldset>
</fieldset>
{%- endblock fieldset_form_row %}
{% block submit_row -%}
<div class="form-group row">{#--#}
<div class="{{ block('form_label_class') }}"></div>{#--#}
<div class="form-group row">
<div class="{{ block('form_label_class') }}"></div>
<div class="{{ block('form_group_class') }}">
{{- form_widget(form) -}}
</div>{#--#}
</div>
</div>
{%- endblock submit_row %}
{% block reset_row -%}
<div class="form-group row">{#--#}
<div class="{{ block('form_label_class') }}"></div>{#--#}
<div class="form-group row">
<div class="{{ block('form_label_class') }}"></div>
<div class="{{ block('form_group_class') }}">
{{- form_widget(form) -}}
</div>{#--#}
</div>
</div>
{%- endblock reset_row %}
@ -77,11 +77,11 @@ col-sm-10
{%- endblock form_group_class %}
{% block checkbox_row -%}
<div class="form-group row">{#--#}
<div class="{{ block('form_label_class') }}"></div>{#--#}
<div class="form-group row">
<div class="{{ block('form_label_class') }}"></div>
<div class="{{ block('form_group_class') }}">
{{- form_widget(form) -}}
{{- form_errors(form) -}}
</div>{#--#}
</div>
</div>
{%- endblock checkbox_row %}

View File

@ -286,6 +286,12 @@
{% block form_help -%}
{%- if help is not empty -%}
<small id="{{ id }}_help" class="form-text text-muted">{{ translation_domain is same as(false) ? help : help|trans({}, translation_domain) }}</small>
<small id="{{ id }}_help" class="form-text text-muted">
{%- if translation_domain is same as(false) -%}
{{- help -}}
{%- else -%}
{{- help|trans({}, translation_domain) -}}
{%- endif -%}
</small>
{%- endif -%}
{%- endblock form_help %}

View File

@ -291,7 +291,13 @@
{% block form_help -%}
{%- if help is not empty -%}
<p id="{{ id }}_help" class="help-text">{{ translation_domain is same as(false) ? help : help|trans({}, translation_domain) }}</p>
<p id="{{ id }}_help" class="help-text">
{%- if translation_domain is same as(false) -%}
{{- help -}}
{%- else -%}
{{- help|trans({}, translation_domain) -}}
{%- endif -%}
</p>
{%- endif -%}
{%- endblock form_help %}

View File

@ -1,7 +1,7 @@
<div>
<?php $widgetAtt = empty($help) ? array() : array('attr' => array('aria-describedby' => $id.'_help')); ?>
<?php $widgetAttr = empty($help) ? array() : array('attr' => array('aria-describedby' => $id.'_help')); ?>
<?php echo $view['form']->label($form); ?>
<?php echo $view['form']->errors($form); ?>
<?php echo $view['form']->widget($form, $widgetAtt); ?>
<?php echo $view['form']->widget($form, $widgetAttr); ?>
<?php echo $view['form']->help($form); ?>
</div>

View File

@ -1,3 +1,3 @@
id="<?php echo $view->escape($id); ?>" name="<?php echo $view->escape($full_name); ?>"<?php if ($disabled): ?> disabled="disabled"<?php endif; ?>
<?php if ($required): ?> required="required"<?php endif; ?>
<?php echo $attr ? ' '.$view['form']->block($form, 'attributes') : ''; ?>
id="<?php echo $view->escape($id) ?>" name="<?php echo $view->escape($full_name) ?>"<?php if ($disabled): ?> disabled="disabled"<?php endif ?>
<?php if ($required): ?> required="required"<?php endif ?>
<?php echo $attr ? ' '.$view['form']->block($form, 'attributes') : '' ?>

View File

@ -1,11 +1,11 @@
<tr>
<?php $widgetAtt = empty($help) ? array() : array('attr' => array('aria-describedby' => $id.'_help')); ?>
<?php $widgetAttr = empty($help) ? array() : array('attr' => array('aria-describedby' => $id.'_help')); ?>
<td>
<?php echo $view['form']->label($form); ?>
</td>
<td>
<?php echo $view['form']->errors($form); ?>
<?php echo $view['form']->widget($form, $widgetAtt); ?>
<?php echo $view['form']->widget($form, $widgetAttr); ?>
<?php echo $view['form']->help($form); ?>
</td>
</tr>

View File

@ -184,7 +184,7 @@ class FormType extends BaseType
$resolver->setAllowedTypes('label_attr', 'array');
$resolver->setAllowedTypes('upload_max_size_message', array('callable'));
$resolver->setAllowedTypes('help', array('string', 'NULL'));
$resolver->setAllowedTypes('help', array('string', 'null'));
}
/**