druxt-entity

0.28.1 • Public • Published

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.

Option Type Required Default Description
entity.components.fields boolean No true Whether to import deprecated default Field components.
entity.query.fields string[] No [] An array of fields to filter all Entity JSON:API queries.
entity.query.schema boolean No false Whether to automatically filter fields based on Display schema.

Base Druxt options

These options are available to all Druxt modules.

Option Type Required Default Description
axios object No {} Axios instance settings.
baseUrl string Yes null Base URL for the Drupal installation.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.28.122latest

Version History

VersionDownloads (Last 7 Days)Published
0.28.122
0.28.09
0.27.10
0.27.01
0.26.10
0.26.00
0.25.10
0.25.0238
0.24.30
0.24.20
0.24.10
0.24.00
0.23.00
0.22.00
0.21.40
0.21.30
0.21.20
0.21.10
0.21.00
0.20.00
0.19.00
0.18.00
0.17.10
0.17.00
0.16.00
0.15.00
0.14.20
0.14.11
0.14.00
0.13.00
0.12.00
0.11.20
0.11.10
0.11.00
0.10.10
0.10.00
0.9.00
0.8.10
0.8.00
0.7.20
0.7.10
0.7.00
0.6.31
0.6.21
0.6.10
0.6.00
0.5.20
0.5.10
0.5.00
0.4.00
0.3.10
0.3.00
0.2.20
0.2.10
0.2.00
0.1.00

Package Sidebar

Install

npm i druxt-entity

Homepage

druxtjs.org

Weekly Downloads

273

Version

0.28.1

License

MIT

Unpacked Size

90 kB

Total Files

30

Last publish

Collaborators

  • deciphered