Skip to content

The core module, DruxtClient, DruxtStore and the DruxtModule base component.

includePaths

View source on GitHub

includePaths ⇒ Array.<string>

The paths an include names.

Kind: global constant
Returns: Array.<string> - Each path, trimmed, with empty ones left out.

ParamTypeDescription
[include]string | Array.<string>A comma-separated include, or an array of paths.

topIncludes ⇒ Array.<string>

The relationships of the resource itself that an include reaches.

A nested path includes every relationship along it, so media.image names media too.

Kind: global constant
Returns: Array.<string> - The first relationship of each path, once each.

ParamTypeDescription
[include]string | Array.<string>The include.

Example

topIncludes('media.image,uid') // ['media', 'uid']

subIncludes ⇒ string

The paths below one relationship, relative to it.

Kind: global constant
Returns: string - The paths below it, comma-separated.

ParamTypeDescription
[include]string | Array.<string>The include.
keystringThe relationship.

Example

subIncludes('media,media.image,media.image.file', 'media') // 'image,image.file'

fieldsWithIncludes ⇒ string

A type's sparse fieldset with the relationships an include names added.

Drupal leaves a relationship out of the document when the fieldset doesn't name it, so the store could not find what it included.

Kind: global constant
Returns: string - The fieldset, comma-separated, each field once.

ParamTypeDescription
fieldsstringThe type's comma-separated fieldset.
[include]string | Array.<string>The include.

includesFor ⇒ string | Array.<string> | undefined

The include paths a resource's type can take.

Drupal answers 400 to an include a type lacks. When a query lists a type's fields, as schema mode lists the fields its display renders, a path whose relationship those fields don't name is left out, unless the resource is known to have that relationship.

Kind: global constant
Returns: string | Array.<string> | undefined - The paths it can take, comma-separated, or the include as given when nothing decides.

ParamTypeDescription
[include]string | Array.<string>The include.
[fields]stringThe type's comma-separated fieldset. Without one, the include is kept whole.
[relationships]Array.<string>Relationships the resource is known to have.