---
title: "ModifyTcaSelectFieldItemsEvent"
manual: "Academic Contacts for Pages"
version: "main"
permalink: "https://docs.typo3.org/permalink/fgtclb/academic-contacts4pages:developers-event-modify-tca-select-field-items-event@main"
source: "Developers/Events/ModifyTcaSelectFieldItemsEvent.rst"
rendered: "2026-10-26T19:20:19+00:00"
---

# ModifyTcaSelectFieldItemsEvent {#developers-event-modify-tca-select-field-items-event}

`\FGTCLB\AcademicBase\Event\ModifyTcaSelectFieldItemsEvent` belongs to
**academic_base**. The academic extensions dispatch it from the item
providers of their backend select fields, so a listener changes the items an
editor is offered without replacing the item provider. The event is described
on [its page in the manual of academic_base](https://docs.typo3.org/p/fgtclb/academic-base/main/en-us/Developers/Events/ModifyTcaSelectFieldItemsEvent.html#developers-event-modify-tca-select-field-items-event).
This page describes the selects of **academic_contacts4pages** that
dispatch it.

## When it is dispatched {#when-it-is-dispatched}

`\FGTCLB\AcademicContacts4pages\Backend\FormEngine\AddressRecordItems`
dispatches it each time the backend form of a contact builds the items of one of
its three address selects:

| Field | Label | Method of the item provider |
| --- | --- | --- |
| `email_address` | **E-mail address** | `emailAddressItems()` |
| `phone_number` | **Phone number** | `phoneNumberItems()` |
| `physical_address` | **Physical address** | `physicalAddressItems()` |

The table is `tx_academiccontacts4pages_domain_model_contact`, in the form of a
contact on its own and inline in the tab **Contacts** of a page or
**Linked pages** of a contract. The event is dispatched after the item
provider replaced the record items TYPO3 added with its own list, so a listener
receives the final items.

The **Contract** select of a contact is filled by the item provider of
**academic_persons**, which dispatches the same event for the field
`contract` of this table. [Its page in the manual of academic_persons](https://docs.typo3.org/p/fgtclb/academic-persons/main/en-us/Developers/Events/ModifyTcaSelectFieldItemsEvent.html)
describes the selects it fills.

## What this extension passes in {#what-this-extension-passes-in}

| Method | Returns or does |
| --- | --- |
| `getParameters()` | The parameters of the item provider: `items`, `table`, `field`, `row`, `config`, `TSconfig`, `effectivePid`, `site` and the inline parent keys. The uids of the inline parents are the empty string `''` unless the contact is edited inline, and a `NEW...` string for a parent that is not saved yet. |
| `setParameters()` | Replaces the parameters. What counts is `items`, the list the select offers. |

The items of an address select:

-   **Display all** with the value `0`, the default of the field, and
    **Do not display** with the value `-1`.
-   One item per address of the contract the contact names, with the uid of
    the address as the value and a label built from its type and its text.
    Hidden addresses are offered too, marked as hidden. Only addresses of the
    default language and of the workspace of the editor are offered.

In the backend form, TYPO3 v13 and v14 hand the static items of a field to the
item provider as `\TYPO3\CMS\Core\Schema\Struct\SelectItem` objects,
and the items a provider adds are arrays. A `SelectItem` implements
`\ArrayAccess`, so a closure typed `array|SelectItem` that reads
`$item['value']` works for both.

## Example {#example}

A site wants every contact on its pages to show a phone number, and takes
**Do not display** out of the phone number select:

**EXT:my_extension/Classes/EventListener/AlwaysShowAPhoneNumberOfPageContacts.php**

```php
<?php

declare(strict_types=1);

namespace MyVendor\MyExtension\EventListener;

use FGTCLB\AcademicBase\Event\ModifyTcaSelectFieldItemsEvent;
use TYPO3\CMS\Core\Attribute\AsEventListener;
use TYPO3\CMS\Core\Schema\Struct\SelectItem;

final class AlwaysShowAPhoneNumberOfPageContacts
{
    #[AsEventListener(identifier: 'my-extension/always-show-a-phone-number-of-page-contacts')]
    public function __invoke(ModifyTcaSelectFieldItemsEvent $event): void
    {
        $parameters = $event->getParameters();
        if ($parameters['table'] !== 'tx_academiccontacts4pages_domain_model_contact'
            || $parameters['field'] !== 'phone_number'
        ) {
            return;
        }
        $parameters['items'] = array_values(array_filter(
            $parameters['items'],
            // -1 is "Do not display".
            static fn(array|SelectItem $item): bool => (int)($item['value'] ?? 0) !== -1,
        ));
        $event->setParameters($parameters);
    }
}
```

## Rules and pitfalls {#rules-and-pitfalls}

**Check the table and the field.** One listener receives the event of every
select of every academic extension that dispatches it.

**A removed item does not change stored values.** A contact that stores the
value of an item a listener removed keeps it. The form shows it as an invalid
value, and the frontend renders it as before, until an editor picks another
item. Do not remove **Display all**, the value a new contact gets.

**The items are what the editor is offered, not what the frontend shows.** The
frontend renders the addresses the contact selects, and hidden ones only while
[Show hidden records](https://docs.typo3.org/permalink/fgtclb/academic-contacts4pages:confval-contacts-list-show-hidden-records@main) is on. An
item a listener adds whose value is no address of the contract shows no
address of that kind in the frontend.

## Introduced in {#introduced-in}

-   [Feature: Dedicated selection of address records](https://docs.typo3.org/permalink/fgtclb/academic-contacts4pages:feature-dedicated-address-record-selection@main) added the three selects
    in version 2.4, and with them the dispatch.
-   [Important: The address selects of a page contact are relations](https://docs.typo3.org/permalink/fgtclb/academic-contacts4pages:important-ace-481-academic-contacts4pages@main) made the selects
    relations to the address tables in version 2.4, and states that a
    listener receives the final item list.
