Feature Request: Default values for Plain Text and Rich Text fields #8461
-
|
When creating a new Plain Text or Rich Text field, it would be helpful to be able to optionally enter a default value. This could then be parsed for element variables as an object template. Use case:We have a client with over a thousand entries in a section and a couple fields that follow the same formula, with only the {title} being dynamic. The alternative is creating a Global or putting the default value right in the template. @timkelty was talking about potentially making a plugin for this, but thought it might be a good candidate for a core addition. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 5 replies
-
|
Ended up making this for a client (right now just Craft 2): https://github.com/timkelty/craft2-defaulttext |
Beta Was this translation helpful? Give feedback.
-
|
@brandonkelly Would you accept a PR for this? |
Beta Was this translation helpful? Give feedback.
-
|
@timkelty works here now so maybe we can just get him to PR it :) |
Beta Was this translation helpful? Give feedback.
-
|
We just released Craft 3.7.29 which provides a solution for this: It’s now possible to bulk-set individual element attributes/custom field values via php craft resave/entries --section foo --set myPlainTextField --to "default value" --if-empty |
Beta Was this translation helpful? Give feedback.
We just released Craft 3.7.29 which provides a solution for this: It’s now possible to bulk-set individual element attributes/custom field values via
resave/*commands (see #10356). So for example, after creating a new Plain Text field, you could set a default value on all the entries in afoosection like so:php craft resave/entries --section foo --set myPlainTextField --to "default value" --if-empty