LayoutColumnLayoutElements
Introduction
After defining a Layout with LayoutRows and LayoutColumns you probably want to add items to the defined LayoutColumns.
The layout system is capable of managing different entity types in one LayoutColumns. Information about LayoutElements
that should be displayed on a LayoutColumns is managed by the LayoutColumnLayoutElements
intermediate model.
To access information of this intermediate model such as the sort_number
, you should make use of the pivot
information that will always be returned when including the layoutElements
relation described in LayoutColumns or the layoutColumns
relation on LayoutElements
. You can find the available entity types that can be attached to a LayoutColumn below.
Model Definition
Relations
Key | Relation | Type | Relation Field(s) |
---|---|---|---|
| Belongs to |
| |
|
| Morph to |
|
LayoutElement types
formField
(FormField)
LayoutElement
types are keys for different entities existing in our system. Every LayoutElement
type listed here has itself a relationship to LayoutColumns which can be accessed with the key layoutColumns
.
When retrieving such a relation (internally utilizing this intermediate model), there will always be a pivot
object attached holding the information described in this section.
You can use the pivot information for sorting and such.
Affected entities are marked with the trait LayoutElement
.
Traits
Sortable
SoftDeletes
Attach
Attaches a LayoutElement
to a LayoutColumn and returns all LayoutColumns the given Element is related to after.
Definition
POST
/api/layouts/elements/columns/attach
Request Keys
Key | Type | Default | Description |
---|---|---|---|
| string |
| The title for the layout |
| string | - | Layoutable type (see above) |
| array | - | Layoutable ID (see above) |
| integer | Current highest +1 | The index of the |
Keys with *
are required.
Example Request
Example Response
Sync
Attaches the given LayoutElement
to many LayoutColumns and detaches the element from any LayoutColumn that is not posted.
Definition
POST
/api/layouts/elements/columns/sync
Key | Type | Default | Description |
---|---|---|---|
| string |
| The title for the layout. |
| string | - | Layoutable type (see above). |
| array | - | Layoutable ID (see above). |
| integer | Current highest +1 | The index of the |
Example Request
Example Response
Detach
Detaches a LayoutElement
from a LayoutColumn and returns all LayoutColumns the given Element is related to after.
Definition
POST
/api/layouts/elements/columns/detach
Request Keys
Key | Type | Default | Description |
---|---|---|---|
| string |
| The title for the layout. |
| string | - | Layoutable type (see above). |
| array | - | Layoutable ID (see above). |
| integer | Current highest +1 | The index of the |
Keys with *
are required.
Example Request
Example Response
Last updated