Skip to content

Commit

Permalink
Update Docs: migrate Beta Features - Dynamic Default Values (#7060)
Browse files Browse the repository at this point in the history
  • Loading branch information
privatemaker authored Jan 23, 2024
1 parent 10a7358 commit a3939e0
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 34 deletions.
34 changes: 0 additions & 34 deletions website/content/docs/beta-features.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,40 +141,6 @@ The above config will transform the title field to uppercase and format the date
Available transformations are `upper`, `lower`, `date('<format>')`, `default('defaultValue')`, `ternary('valueForTrue','valueForFalse')` and `truncate(<number>)`/`truncate(<number>, '<string>')`


## Dynamic Default Values

When linking to `/admin/#/collections/posts/new` you can pass URL parameters to pre-populate an entry.

For example given the configuration:

```yaml
collections:
- name: posts
label: Posts
folder: content/posts
create: true
fields:
- label: Title
name: title
widget: string
- label: Object
name: object
widget: object
fields:
- label: Title
name: title
widget: string
- label: body
name: body
widget: markdown
```

clicking the following link: `/#/collections/posts/new?title=first&object.title=second&body=%23%20content`

will open the editor for a new post with the `title` field populated with `first`, the nested `object.title` field
with `second` and the markdown `body` field with `# content`.

**Note:** URL Encoding might be required for certain values (e.g. in the previous example the value for `body` is URL encoded).


## Remark plugins
Expand Down
38 changes: 38 additions & 0 deletions website/content/docs/dynamic-default-values.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
title: Dynamic Default Values
group: Fields
weight: 30
---

When linking to `/admin/#/collections/posts/new` you can pass URL parameters to pre-populate an entry.

For example given the configuration:

```yaml
collections:
- name: posts
label: Posts
folder: content/posts
create: true
fields:
- label: Title
name: title
widget: string
- label: Object
name: object
widget: object
fields:
- label: Title
name: title
widget: string
- label: body
name: body
widget: markdown
```
clicking the following link: `/#/collections/posts/new?title=first&object.title=second&body=%23%20content`

will open the editor for a new post with the `title` field populated with `first`, the nested `object.title` field
with `second` and the markdown `body` field with `# content`.

**Note:** URL Encoding might be required for certain values (e.g. in the previous example the value for `body` is URL encoded).

0 comments on commit a3939e0

Please sign in to comment.