API Documentation
DruxtEntityForm
DruxtEntity
DruxtEntityForm ⇐ The DruxtEntityForm component renders a Drupal Content Entity edit form by JSON:API resource type, UUID, view mode and schema type.
Fields are rendered as DruxtField components, based on the Drupal display mode configuration.
Extends: DruxtEntity
See: DruxtEntity
Example
<DruxtEntityForm
:type="resourceType"
:uuid="uuid"
:mode="displayMode"
v-on:error="onError()"
v-on:reset="onReset()"
v-on:submit="onSubmit()"
/>
Example (DruxtEntityForm Wrapper component boilerplate)
<template>
<DruxtDebug :json="entity" />
</template>
<script>
import { DruxtEntityMixin } from 'druxt-entity'
export default {
mixins: [DruxtEntityMixin]
}
Example (DruxtEntityForm with template injection)
<DruxtEntityForm type="">
<template #default="{ entity }">
<!-- Do whatever you want here -->
<DruxtDebug :json="entity" />
</template>
</DruxtEntity>
- DruxtEntityForm ⇐
DruxtEntity
- instance
- static
.onReset()
Reset event handler:
- Sets
model
back toentity
value. - Unsets
response
data. - Emits
reset
.
Kind: instance method of DruxtEntityForm
.onSubmit()
Submit event handler:
- Sends data to backend via POST or PATCH.
- Catches errors.
- Emits
submit
orerror
event.
Kind: instance method of DruxtEntityForm
.extends
Kind: static property of DruxtEntityForm
See: DruxtEntity
.props
Vue.js Properties.
Kind: static property of DruxtEntityForm
'view'
| 'form'
.schemaType : Drupal display schema type, 'view' or 'form'.
Kind: static property of props
Default: form
.langcode
The resource langcode.
Kind: static property of props
Example
<DruxtEntityForm langcode="en" />
.v-model
The module component model value.
Used to bypass the Drupal JSON:API fetch, setting the module data directly.
Kind: static property of props
Example
<DruxtEntityForm v-model="{ foo: bar }" />
.wrapper
The wrapper component configuration.
Used to set the wrapper component, class, style and propsData.
Kind: static property of props
Example
<DruxtEntityForm
:wrapper="{
component: 'MyWrapper',
class: 'wrapper',
propsData: { foo: 'bar' }
}"
/>
.mode
Drupal display mode.
Kind: static property of props
.settings
Module settings object.
Kind: static property of props
.type
JSON:API resource type.
Kind: static property of props
.uuid
Entity UUID.
Kind: static property of props
.computed
Vue.js Computed properties.
Kind: static property of DruxtEntityForm
Array.<object>
.errors ⇒ An array of errors if present in the form submission response data.
Kind: static property of computed
.data()
Vue.js Data object.
Kind: static method of DruxtEntityForm
Properties
Name | Type | Description |
---|---|---|
response | object | The form submission response data. |
submitting | boolean | Whether the form is currently being submitted. |