> For the complete documentation index, see [llms.txt](https://docs.api.intratool.de/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.api.intratool.de/api-reference/layouts/layout-column-layout-elements.md).

# LayoutColumnLayoutElements

## Introduction

`LayoutColumnLayoutElements` manage the polymorphic assignment of a layout element, such as a [FormField](/api-reference/forms/form-fields.md), to [LayoutColumns](/api-reference/layouts/layout-columns.md).

## Model Definition

**Alias**

`layoutColumnLayoutElement`

**Relations**

| Key             | Relation                                                 | Type       | Relation Field(s)                          |
| --------------- | -------------------------------------------------------- | ---------- | ------------------------------------------ |
| `layoutElement` | Supported layout element                                 | Morph to   | `layout_element_type`, `layout_element_id` |
| `layoutColumn`  | [LayoutColumn](/api-reference/layouts/layout-columns.md) | Belongs to | `layout_column_id`                         |

## List Columns for Element

List `LayoutColumns` attached to one layout element.

**Definition**

<mark style="color:green;">`GET`</mark> `/api/layouts/elements/columns`

**Request Keys**

| Key                     | Type      | Default  | Description                           |
| ----------------------- | --------- | -------- | ------------------------------------- |
| `layout_element_type`\* | `string`  | -        | Supported layout-element morph alias. |
| `layout_element_id`\*   | `integer` | -        | Layout element ID.                    |
| `limit`                 | `integer` | No limit | Maximum number of assigned columns.   |

Keys with `*` are required.

**Behavior**

Send the required keys as query parameters. The PHP example includes them in the request's `query` option.

**Example Request**

{% tabs %}
{% tab title="PHP" %}

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

{% endtab %}
{% endtabs %}

**Example Response**

```json
[
  {
    "id": 71,
    "title": "Contact details",
    "width": 8,
    "layout_row_id": 61,
    "lang_id": "en-US",
    "top_separator": false,
    "right_separator": true,
    "bottom_separator": false,
    "left_separator": false,
    "sort_number": 1,
    "pivot": {
      "id": 201,
      "layout_element_type": "formField",
      "layout_element_id": 301,
      "layout_column_id": 71,
      "sort_number": 1
    }
  },
  {
    "id": 72,
    "title": "Owner",
    "width": 4,
    "layout_row_id": 61,
    "lang_id": "en-US",
    "top_separator": false,
    "right_separator": false,
    "bottom_separator": false,
    "left_separator": true,
    "sort_number": 2,
    "pivot": {
      "id": 202,
      "layout_element_type": "formField",
      "layout_element_id": 301,
      "layout_column_id": 72,
      "sort_number": 2
    }
  }
]
```

## Attach Columns

Attach `LayoutColumns` to one layout element.

**Definition**

<mark style="color:yellow;">`POST`</mark> `/api/layouts/elements/columns/attach`

**Request Keys**

| Key                     | Type      | Default | Description                                                                                   |
| ----------------------- | --------- | ------- | --------------------------------------------------------------------------------------------- |
| `layout_element_type`\* | `string`  | -       | Supported layout-element morph alias, for example `formField`.                                |
| `layout_element_id`\*   | `integer` | -       | Layout element ID.                                                                            |
| `layout_column_ids`\*   | `array`   | -       | Column records containing `layout_column_id` and optional pivot values such as `sort_number`. |

Keys with `*` are required.

**Behavior**

Existing pivots are updated; missing pivots are created. The response contains the requested columns still attached to the element.

**Example Request**

{% tabs %}
{% tab title="PHP" %}

```php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('POST', '/api/layouts/elements/columns/attach', [
    'headers' => ['Authorization' => "Bearer {accessToken}"],
    'json' => [
        'layout_element_type' => 'formField',
        'layout_element_id' => 301,
        'layout_column_ids' => [
            [
                'layout_column_id' => 71,
                'sort_number' => 1
            ],
            [
                'layout_column_id' => 72,
                'sort_number' => 2
            ]
        ]
    ]
]);
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
[
  {
    "id": 71,
    "title": "Contact details",
    "width": 8,
    "layout_row_id": 61,
    "lang_id": "en-US",
    "top_separator": false,
    "right_separator": true,
    "bottom_separator": false,
    "left_separator": false,
    "sort_number": 1,
    "pivot": {
      "id": 201,
      "layout_element_type": "formField",
      "layout_element_id": 301,
      "layout_column_id": 71,
      "sort_number": 1
    }
  },
  {
    "id": 72,
    "title": "Owner",
    "width": 4,
    "layout_row_id": 61,
    "lang_id": "en-US",
    "top_separator": false,
    "right_separator": false,
    "bottom_separator": false,
    "left_separator": true,
    "sort_number": 2,
    "pivot": {
      "id": 202,
      "layout_element_type": "formField",
      "layout_element_id": 301,
      "layout_column_id": 72,
      "sort_number": 2
    }
  }
]
```

## Sync Columns

Synchronize the `LayoutColumns` attached to one layout element.

**Definition**

<mark style="color:yellow;">`POST`</mark> `/api/layouts/elements/columns/sync`

**Request Keys**

| Key                     | Type      | Default | Description                                                                                   |
| ----------------------- | --------- | ------- | --------------------------------------------------------------------------------------------- |
| `layout_element_type`\* | `string`  | -       | Supported layout-element morph alias, for example `formField`.                                |
| `layout_element_id`\*   | `integer` | -       | Layout element ID.                                                                            |
| `layout_column_ids`\*   | `array`   | -       | Column records containing `layout_column_id` and optional pivot values such as `sort_number`. |

Keys with `*` are required.

**Behavior**

Assignments not present in `layout_column_ids` are detached; supplied assignments are updated or created.

**Example Request**

{% tabs %}
{% tab title="PHP" %}

```php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('POST', '/api/layouts/elements/columns/sync', [
    'headers' => ['Authorization' => "Bearer {accessToken}"],
    'json' => [
        'layout_element_type' => 'formField',
        'layout_element_id' => 301,
        'layout_column_ids' => [
            [
                'layout_column_id' => 72,
                'sort_number' => 1
            ]
        ]
    ]
]);
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
[
  {
    "id": 72,
    "title": "Owner",
    "width": 4,
    "layout_row_id": 61,
    "lang_id": "en-US",
    "top_separator": false,
    "right_separator": false,
    "bottom_separator": false,
    "left_separator": true,
    "sort_number": 2,
    "pivot": {
      "id": 202,
      "layout_element_type": "formField",
      "layout_element_id": 301,
      "layout_column_id": 72,
      "sort_number": 1
    }
  }
]
```

## Detach Columns

Detach `LayoutColumns` from one layout element.

**Definition**

<mark style="color:yellow;">`POST`</mark> `/api/layouts/elements/columns/detach`

**Request Keys**

| Key                     | Type      | Default | Description                                                                                   |
| ----------------------- | --------- | ------- | --------------------------------------------------------------------------------------------- |
| `layout_element_type`\* | `string`  | -       | Supported layout-element morph alias, for example `formField`.                                |
| `layout_element_id`\*   | `integer` | -       | Layout element ID.                                                                            |
| `layout_column_ids`\*   | `array`   | -       | Column records containing `layout_column_id` and optional pivot values such as `sort_number`. |

Keys with `*` are required.

**Example Request**

{% tabs %}
{% tab title="PHP" %}

```php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('POST', '/api/layouts/elements/columns/detach', [
    'headers' => ['Authorization' => "Bearer {accessToken}"],
    'json' => [
        'layout_element_type' => 'formField',
        'layout_element_id' => 301,
        'layout_column_ids' => [
            [
                'layout_column_id' => 72
            ]
        ]
    ]
]);
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
[]
```
