Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/elvishp2006/carbon-field-rest-api-select
Add a rest_api_select field.
https://github.com/elvishp2006/carbon-field-rest-api-select
carbon-fields wordpress
Last synced: 3 months ago
JSON representation
Add a rest_api_select field.
- Host: GitHub
- URL: https://github.com/elvishp2006/carbon-field-rest-api-select
- Owner: elvishp2006
- License: gpl-3.0
- Created: 2018-08-30T21:16:40.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-10-21T10:52:20.000Z (3 months ago)
- Last Synced: 2024-10-21T15:45:09.140Z (3 months ago)
- Topics: carbon-fields, wordpress
- Language: JavaScript
- Size: 1.02 MB
- Stars: 10
- Watchers: 2
- Forks: 1
- Open Issues: 26
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Carbon Field REST API Select
Disponibilize the ```rest_api_select``` field that fill options using the WP REST API.
## Installing
```
composer require elvishp2006/carbon-field-rest-api-select
```## Example
```php
Field::make( 'rest_api_select', 'id', __( 'Post' ) )
->set_endpoint_label_path( 'title.rendered' ) // Default: 'title.rendered'
->set_endpoint_value_path( 'id' ) // Default 'id'
->set_endpoint_search_param( 'search' ) // Default 'search'
->set_endpoint_params(
[
'per_page' => 20,
'orderby' => 'relevance',
]
)
->set_endpoint( rest_url( 'wp/v2/posts' ) )
```