Skip to content

Commit

Permalink
Merge pull request #1952 from bolt/feature/allow-default-values-for-n…
Browse files Browse the repository at this point in the history
…ew-Content

Allow default values for Fields in new Content
  • Loading branch information
I-Valchev committed Oct 7, 2020
2 parents b6ba7a1 + e317ccf commit c7b9e42
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions templates/_partials/fields/_base.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@
{% if value is string %}
{% set value = value|replace({'{{': "{\xE2\x80\x8B{", '}}': "}\xE2\x80\x8B}" }) %}
{% endif %}

{# Set a default, for example when an extension requests `/bolt/new/entries?field-title=Foo+Bar #}
{% if not record.id|default() and not value %}
{% set value = app.request.get(id) %}
{% endif %}
{% endif %}

{# Set the class #}
Expand Down

0 comments on commit c7b9e42

Please sign in to comment.