API Documentation

DruxtSchema()

schema

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.

new DruxtSchema(baseUrl, [options])

DruxtSchemaRouter constructor.

  • Validates module options.
  • Sets up options.
  • Sets up Druxt.js Router instance.
  • (Optional) Sets up oauth2 authentication.
ParamTypeDefaultDescription
baseUrlstringThe Drupal base URL.
[options]objectDruxt Router options.
[options.axios]objectAxios instance settings.
[options.endpoint]string"jsonapi"The JSON:API endpoint.

Example

const schema = new DruxtSchema('https://example.com', {})

.druxt : DruxtClient

Instance of the Druxt Client.

Kind: instance property of DruxtSchema
See: http://druxtjs.org/api/client


.get() ⇒ object

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 to getAll().

Example

const { schemas } = await schema.get()

.getSchema(config, [options]) ⇒ Schema

Gets a matching schema as per the provided configuration.

Kind: instance method of DruxtSchema
Returns: Schema - The generated Schema.
See: Schema

ParamTypeDescription
configSchemaConfigurationThe Schema configuration object.
config.entityTypestringThe Drupal Entity type.
config.bundlestringThe Entity bundle.
[options]object-

Example

const config = {
  entityType: 'node',
  bundle: 'page'
}
const schema = await schema.getSchema(config)

SchemaConfiguration : object

Kind: global typedef
See: SchemaConfiguration