Skip to content

Layouts

Introduction

Layouts describe user defined display information for many different entities. Especially used on Form components Layouts are the main component for relating display information to different types.

Layouts usually consist of at least one LayoutRow and LayoutColumn. Elements are attached to LayoutColumns utilizing LayoutColumnLayoutElements.

Model & Relations

Namespace

Modules\Layout\Entities\Layout

Relations

RelationKeyTypeRelation Field(s)
Layoutable (see below)layoutableMorph tolayoutable_type, layoutable_id
LayoutRowslayoutRowsHas manylayoutRows.layout_id

Layoutable types

Note

Layoutable types are keys for different entities existing in our system. Every layoutable type listed here has itself a relationship to Layouts which can be accessed with the key layout.

Affected entities are marked with the trait Layoutable.

Types

Currently only the default type is supported.

Traits

  • Sortable
  • SoftDeletes

List

Get a list of all Layouts available in the system.

Definition

GET /api/layouts

Example Request

php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('GET', '/api/layouts', [
    'headers' => ['Authorization' => "Bearer {accessToken}"]
]);

Example Response

json
[
  {
    "id": 1,
    "title": null,
    "layoutable_type": "form",
    "layoutable_id": 2,
    "type": "default",
    "sort_number": 1,
    "created_at": "2021-10-26 15:00:20",
    "updated_at": "2021-10-26 15:00:20",
    "deleted_at": null
  },
  {
    "id": 2,
    "title": null,
    "layoutable_type": "form",
    "layoutable_id": 6,
    "type": "default",
    "sort_number": 1,
    "created_at": "2022-05-01 15:16:01",
    "updated_at": "2022-05-01 15:16:01",
    "deleted_at": null
  }
]

Get

Get a single Layout by id.

Definition

GET /api/layouts/{id}

Example Request

php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('GET', '/api/layouts/1', [
    'headers' => ['Authorization' => "Bearer {accessToken}"],
]);

Example Response

json
{
  "id": 1,
  "title": null,
  "layoutable_type": "form",
  "layoutable_id": 2,
  "type": "default",
  "sort_number": 1,
  "created_at": "2021-10-26 15:00:20",
  "updated_at": "2021-10-26 15:00:20",
  "deleted_at": null
}

Create

Creates a new Layout

Definition

POST /api/layouts/

Request Keys

KeyTypeDefaultDescription
titlestringnullThe title for the layout
layoutable_type*string-Layoutable type (see above)
layoutable_id*string-Layoutable ID (see above)
type*required"default"The type of the layout (see above)
sort_numberrequiredCurrent highest +1The index of the Layout related to the Layoutable

Keys with * are required.
Keys with ** are normalized to the information given by the route.

Advanced Key-Specifications

  • type - The given type must be unique for the targeted Layoutable

Example Request

php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('POST', '/api/layouts/', [
    'headers' => ['Authorization' => "Bearer {accessToken}"],
    'json' => [
        "title": null,
        'layoutable_type' => 'form',
        'layoutable_id' => '24',
        'type' => 'default',
        'sort_number' => '1',
    ]
]);

Example Response

json
{
  "status": "success",
  "data": {
    "id": 16,
    "title": null,
    "layoutable_type": "form",
    "layoutable_id": 24,
    "type": "default",
    "sort_number": 1,
    "created_at": "2023-04-28 13:44:46",
    "updated_at": "2023-04-28 13:44:46",
    "deleted_at": null
  }
}

Update

Update an existing Layout by id.

Definition

PUT /api/layouts/{id}

Request Keys

KeyTypeDefaultDescription
titlestring-The title for the layout
layoutable_typestring-Layoutable type (see above)
layoutable_idstring-Layoutable ID (see above)
typerequired-The type of the layout (see above)
sort_numberrequiredCurrent highest +1The index of the Layout related to the Layoutable

Keys with * are required.
Keys with ** are normalized to the information given by the route.

Advanced Key-Specifications

  • type - A given type must be unique for the targeted Layoutable

Example Request

php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('PUT', '/api/layouts/1', [
    'headers' => ['Authorization' => "Bearer {accessToken}"],
    'json' => [
        'title' => null,
        'layoutable_type' => 'form',
        'layoutable_id' => '24',
        'type' => 'default'
        'sort_number' => 2
    ]
]);

Example Response

json
{
  "status": "success",
  "data": {
    "id": 16,
    "title": null,
    "layoutable_type": "form",
    "layoutable_id": 24,
    "type": "default",
    "sort_number": 2,
    "created_at": "2023-04-28 13:44:46",
    "updated_at": "2023-04-28 13:45:28",
    "deleted_at": null
  }
}

Delete

Delete an existing Layout by id.

Definition

DELETE /api/layouts/{id}

Example Request

php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('DELETE', '/api/layouts/1', [
    'headers' => ['Authorization' => "Bearer {accessToken}"]
]);

Example Response

json
{
  "status": "success",
  "data": null
}