Skip to content

LayoutColumns

Introduction

LayoutColumns represent a column in a user defined Layout. LayoutColumns are always related to a LayoutRow and consist of many LayoutElements.

Any LayoutElement that should be ordered and displayed following a Layout has to be attached to a LayoutColumn (see attaching Elements in LayoutColumnLayoutElements)

Model & Relations

Namespace

Modules\Layout\Entities\LayoutColumn

Relations

RelationKeyTypeRelation Field(s)
LayoutRowlayoutRowBelongs tolayout_row_id
LayoutElementslayoutElementsBelongs to manyIntermediate Table

Traits

  • Sortable
  • SoftDeletes

List

Get a list of all LayoutColumns available in the system.

Definition

GET /api/layouts/columns

Example Request

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

Example Response

json
[
  {
    "id": 1,
    "title": null,
    "layout_row_id": 1,
    "width": 12,
    "sort_number": 1,
    "created_at": "2021-10-25 19:07:59",
    "updated_at": "2021-10-25 19:07:59",
    "deleted_at": null
  },
  {
    "id": 2,
    "title": null,
    "layout_row_id": 2,
    "width": null,
    "sort_number": 1,
    "created_at": "2021-10-25 19:08:00",
    "updated_at": "2021-10-25 19:08:00",
    "deleted_at": null
  },
  {
    "id": 3,
    "title": null,
    "layout_row_id": 2,
    "width": null,
    "sort_number": 2,
    "created_at": "2021-10-25 19:08:00",
    "updated_at": "2021-10-25 19:08:00",
    "deleted_at": null
  }
]

Get

Get a single LayoutColumn by id.

Definition

GET /api/layouts/columns/{id}

Example Request

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

Example Response

json
{
  "id": 1,
  "title": null,
  "layout_row_id": 1,
  "width": 12,
  "sort_number": 1,
  "created_at": "2021-10-25 19:07:59",
  "updated_at": "2021-10-25 19:07:59",
  "deleted_at": null
}

Create

Creates a new LayoutColumn

Definition

POST /api/layouts/columns

Request Keys

KeyTypeDefaultDescription
titlestringnullThe title for the LayoutColumn
layout_row_id*integer-The LayoutRow this LayoutColumn belongs to
widthintegernullThe displayed column width
sort_numberintegerCurrent highest +1The index of the LayoutColumn related to the LayoutRow

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

Advanced Key-Specifications

  • width - The maximum usable width in a row is 12. Thus given a column can have a maximum width of 12 if it's a single column. When passing a different value than null (= flexible) the maximum value is calculated by substracting the cumulated width values of already existing columns from 12.

Example: There are two LayoutColumns existing with a width of 4 and 6. The maximum width for a third column would be 2 then.


Example Request

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

Example Response

json
{
  "status": "success",
  "data": {
    "id": 1,
    "title": null,
    "layout_row_id": 1,
    "width": null,
    "sort_number": 1,
    "created_at": "2023-04-28 13:55:21",
    "updated_at": "2023-04-28 13:55:21",
    "deleted_at": null
  }
}

Update

Update an existing LayoutColumn by id.

Definition

PUT /api/layouts/columns/{id}

Request Keys

KeyTypeDefaultDescription
titlestring-The title for the LayoutColumn
layout_row_idinteger-The LayoutRow this LayoutColumn belongs to
widthinteger-The displayed column width
sort_numberinteger-The index of the LayoutColumn related to the LayoutRow

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

Example Request

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

Example Response

json
{
  "status": "success",
  "data": {
    "id": 1,
    "title": null,
    "layout_row_id": 1,
    "width": 6,
    "sort_number": 1,
    "created_at": "2023-04-28 13:55:21",
    "updated_at": "2023-04-28 13:55:21",
    "deleted_at": null
  }
}

Delete

Delete an existing LayoutColumn by id.

Definition

DELETE /api/layouts/columns/{id}

Example Request

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

Example Response

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