Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow default values for Fields in new Content #1952

Merged
merged 4 commits into from
Oct 7, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
16 changes: 16 additions & 0 deletions config/bolt/contenttypes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,22 @@ homepage:
icon_many: "fa:home"
icon_one: "fa:home"

dummies:
bobdenotter marked this conversation as resolved.
Show resolved Hide resolved
name: Dummies
singular_name: Dummy
fields:
title:
type: text
slug:
type: slug
uses: title
veld:
type: collection
fields:
foo:
type: html
icon_many: "fa:viruses"
icon_one: "fa:virus"

# Pages can be used for the more 'static' pages on your site. This content-type
# has a 'templateselect' field, which allows you to override the record_template
Expand Down
3 changes: 3 additions & 0 deletions symfony.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1074,6 +1074,9 @@
"symplify/smart-file-system": {
"version": "v7.2.2"
},
"symplify/symplify-kernel": {
"version": "8.3.30"
},
"theseer/tokenizer": {
"version": "1.1.3"
},
Expand Down
2 changes: 1 addition & 1 deletion templates/_partials/fields/_base.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
{% endif %}

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