Post Input v3.24
Enables to reference posts through a search interface.
js
{
input: {
type: 'post',
postTypes: ['page', 'post']
}
}INFO
It is recommended to use the post input type instead of the relation input type for post references. There are several advantages:
- you don't need to expose your post types in the REST API
- simpler and less error-prone input API
- the ability to handle larger amount of items
Input Options
| Option | Values | Default | Description |
|---|---|---|---|
postTypes | string[] | ['page', 'post'] | Define post types of relation. |
placeholder | string | 'Element suchen' | Text displayed as search input placeholder. |
multiple | boolean | false | Whether multiple posts can be selected. |
allowDuplicates | boolean | true | Whether duplicate posts can be added if multiple is true. |
editLink | string | boolean | true | Declare edit link for individual posts, %s will be replaced with its post ID. If set to false, edit links will be disabled. If set to true, a default edit link will be determined automatically. |
Value Format
The value of the post input is an object of the following shape (or an array thereof, if multiple is true):
js
{
id: 123,
label: 'My Post',
type: 'my-post-type', // post type name
permalink: '/my-post/',
}WARNING
If you switch from a relation input to the post input, make sure that your template function does not use the payload property, as this property is not available in the post input value format!
Conditions
The post input type supports the following conditions for dynamic visibility:
| Condition | Payload | Description |
|---|---|---|
isEmpty | booleandefaults to true | Checks whether a post has been selected or not. |