# 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.
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', {})
1

# .druxt : DruxtClient

Instance of the Druxt Client.

Kind: instance property of DruxtSchema
See: http://druxtjs.org/api/client (opens new window)


# .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()
1

# .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

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)
1
2
3
4
5

# SchemaConfiguration : object

Kind: global typedef
See: SchemaConfiguration