Skip to content

Commit ac8a988

Browse files
javiereguiluzxabbuh
authored andcommitted
minor #16506 [Form] Update create_form_type_extension.rst (issamkhadiri1989)
This PR was submitted for the 6.0 branch but it was merged into the 5.4 branch instead. Discussion ---------- [Form] Update create_form_type_extension.rst Hello, I think the condition `image_url is not null` is not enough as if we create a FileType form field without the `image_property` it causes an error. Adding `image_url is defined` is necessary because the variable `image_url` is only defined and passed to the view when `image_property` is already defined. <!-- If your pull request fixes a BUG, use the oldest maintained branch that contains the bug (see https://symfony.com/releases for the list of maintained branches). If your pull request documents a NEW FEATURE, use the same Symfony branch where the feature was introduced (and `6.x` for features of unreleased versions). --> Commits ------- 85470c5 Update create_form_type_extension.rst
1 parent 05b7ee8 commit ac8a988

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

form/create_form_type_extension.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ Specifically, you need to override the ``file_widget`` block:
192192

193193
{% block file_widget %}
194194
{{ block('form_widget') }}
195-
{% if image_url is not null %}
195+
{% if image_url is defined and image_url is not null %}
196196
<img src="{{ asset(image_url) }}"/>
197197
{% endif %}
198198
{% endblock %}

0 commit comments

Comments
 (0)