0.28.1 • Published 1 year ago

druxt-entity v0.28.1

Weekly downloads
266
License
MIT
Repository
github
Last release
1 year ago

DruxtEntity

npm CircleCI Known Vulnerabilities codecov

Drupal Display Mode powered Entity, Form and Field Druxt components.

Links

Install

$ npm install druxt-entity

Nuxt.js

Add module to nuxt.config.js

module.exports = {
  modules: ['druxt-entity'],
  druxt: {
    baseUrl: 'https://demo-api.druxtjs.org',
    entity: {
      component: {
        fields: false,
      },
      query: {
        schema: true,
        fields: ['path', 'title'],
      },
    },
  },
}

Usage

DruxtEntity component

The DruxtEntity component renders content entities using Drupal's View display modes.

<DruxtEntity :type="resourceType" :uuid="uuid" :mode="displayMode" />

Example DruxtEntity component

See the DruxtEntity API Documentation for more information.

DruxtEntityForm component

The DruxtEntityForm component uses Drupal's Form displays modes for content creation and editing.

<DruxtEntityForm :type="resourceType" :mode="displayMode" />

Example DruxtEntityForm component

See the DruxtEntityForm API Documentation for more information.

Theming

Both components can be themed by providing a default template:

<DruxtEntity type="node--page" :uuid="uuid">
  <template #default="{ entity, fields, schema }">
    {{ entity }}
  </template>
</DruxtEntity>

The module also provides Wrapper components with scoped slots for theming:

<template>
  <div>
    <h1>{{ $attrs.entity.attributes.title }}</h1>
    <slot name="body" />
  <div>
</template>

See the Druxt Theming guide for more information.

Options

Druxt Entity options

These options are specific to this module.

OptionTypeRequiredDefaultDescription
entity.components.fieldsbooleanNotrueWhether to import deprecated default Field components.
entity.query.fieldsstring[]No[]An array of fields to filter all Entity JSON:API queries.
entity.query.schemabooleanNofalseWhether to automatically filter fields based on Display schema.

Base Druxt options

These options are available to all Druxt modules.

OptionTypeRequiredDefaultDescription
axiosobjectNo{}Axios instance settings.
baseUrlstringYesnullBase URL for the Drupal installation.
0.28.1

1 year ago

0.28.0

1 year ago

0.27.1

2 years ago

0.27.0

2 years ago

0.26.1

2 years ago

0.25.1

2 years ago

0.26.0

2 years ago

0.25.0

3 years ago

0.24.3

3 years ago

0.21.4

3 years ago

0.21.3

3 years ago

0.23.0

3 years ago

0.24.2

3 years ago

0.24.1

3 years ago

0.24.0

3 years ago

0.22.0

3 years ago

0.21.0

3 years ago

0.21.2

3 years ago

0.21.1

3 years ago

0.20.0

3 years ago

0.19.0

3 years ago

0.18.0

3 years ago

0.17.0

3 years ago

0.17.1

3 years ago

0.16.0

3 years ago

0.15.0

3 years ago

0.14.1

3 years ago

0.14.2

3 years ago

0.13.0

4 years ago

0.14.0

4 years ago

0.12.0

4 years ago

0.11.2

4 years ago

0.11.1

4 years ago

0.11.0

4 years ago

0.10.1

4 years ago

0.10.0

4 years ago

0.9.0

4 years ago

0.8.1

4 years ago

0.8.0

4 years ago

0.7.2

4 years ago

0.7.1

4 years ago

0.7.0

4 years ago

0.6.3

4 years ago

0.6.2

4 years ago

0.6.1

4 years ago

0.6.0

4 years ago

0.5.2

4 years ago

0.5.1

4 years ago

0.5.0

4 years ago

0.4.0

4 years ago

0.3.1

4 years ago

0.3.0

4 years ago

0.2.2

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.0

5 years ago