API Documentation
DruxtSchema()
Classes
- DruxtSchema
The DruxtSchema class.
Builds Druxt Schema objects using Drupal JSON:API Entity Form and View Display mode data.
Typedefs
- SchemaConfiguration :
object
DruxtSchema
The DruxtSchema class.
Builds Druxt Schema objects using Drupal JSON:API Entity Form and View Display mode data.
Kind: global class
Todo
- Document DruxtSchema authentication options.
- Document DruxtSchema filter options.
- DruxtSchema
- new DruxtSchema(baseUrl, [options])
- .druxt :
DruxtClient
- .get() ⇒
object
- .getSchema(config, [options]) ⇒
Schema
new DruxtSchema(baseUrl, [options])
DruxtSchemaRouter constructor.
- Validates module options.
- Sets up options.
- Sets up Druxt.js Router instance.
- (Optional) Sets up oauth2 authentication.
Param | Type | Default | Description |
---|---|---|---|
baseUrl | string | The Drupal base URL. | |
[options] | object | Druxt Router options. | |
[options.axios] | object | Axios instance settings. | |
[options.endpoint] | string | "jsonapi" | The JSON:API endpoint. |
Example
const schema = new DruxtSchema('https://example.com', {})
DruxtClient
.druxt : Instance of the Druxt Client.
Kind: instance property of DruxtSchema
See: http://druxtjs.org/api/client
object
.get() ⇒ Gets all available schemas for Entitiy Views and Form modes.
Kind: instance method of DruxtSchema
Returns: object
- The JSON:API Resource index and processed schemas.
Todo
- Rename the
get()
method togetAll()
.
Example
const { schemas } = await schema.get()
Schema
.getSchema(config, [options]) ⇒ Gets a matching schema as per the provided configuration.
Kind: instance method of DruxtSchema
Returns: Schema
- The generated Schema.
See: Schema
Param | Type | Description |
---|---|---|
config | SchemaConfiguration | The Schema configuration object. |
config.entityType | string | The Drupal Entity type. |
config.bundle | string | The Entity bundle. |
[options] | object | - |
Example
const config = {
entityType: 'node',
bundle: 'page'
}
const schema = await schema.getSchema(config)
object
SchemaConfiguration : Kind: global typedef
See: SchemaConfiguration