Download the PHP package oliverthiele/ot-recordselector without Composer

On this page you can find all versions of the php package oliverthiele/ot-recordselector. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package ot-recordselector

OT Record Selector — TYPO3 Backend Form Element

A custom backend form element for TYPO3 that lets editors search and select records by name — showing translated titles and field values in the editor's own language, with relevance ranking, configurable info fields, preview images, and TYPO3-native card display.

TYPO3 Packagist Version PHP


Why not just use type=group or selectMultipleSideBySide?

TYPO3 core offers several ways to link records. They share a common limitation: results are sorted alphabetically with no relevance ranking, and records always appear in the default language regardless of which language the editor is currently working in.

OT Record Selector takes a different approach:


Features


Requirements

Requirement Version
TYPO3 14.3+
PHP 8.4+

No additional dependencies. The element uses @typo3/core/ajax/ajax-request.js and <typo3-backend-icon> from TYPO3 core.


Installation

Then run the TYPO3 setup:


Configuration

Register the form element in your TCA column configuration:

Database column must be declared manually

type=user is not one of the TCA field types TYPO3 core auto-generates a database column for. Core's schema enrichment (TYPO3\CMS\Core\Database\Schema\DefaultTcaSchema) has a dedicated case for select/group/inline/category/file and several others, but none for user — so setting foreign_table here has no effect on the database schema, unlike a real type=select relation.

You must declare the storage column yourself in the consuming extension's ext_tables.sql:

If this declaration is missing or gets accidentally removed, the column can still exist in the live database (e.g. left over from before the field was converted to otRecordSelector, or created manually) — but because Core no longer expects it, running database:updateschema and confirming the "remove" step will rename it to zzz_deleted_my_field instead of dropping it outright. The data survives, but Extbase silently drops the property during hydration (no matching column map), so the corresponding getter returns null — or throws a TypeError if its return type isn't nullable.

This is the trade-off for the performance win over type=select with a large foreign_table: you keep the fast, ranked search, but you take over the schema bookkeeping that Core would otherwise do for you. Always add the column to ext_tables.sql explicitly, and re-verify it after any TCA field type change (select → user or back).

All TCA options

Option Type Default Description
foreign_table string — Required. Target table name (must exist in TCA)
maxitems int 1 1 = single select, hides search after selection; >1 = multi-select, stores comma-separated UIDs
minitems int 0 Minimum required selections (not yet validated client-side)
infoFields string uid Comma-separated list of fields to show as labeled metadata. Use uid and pid as special keywords.
searchFields string — Comma-separated DB columns to search in. Falls back to ctrl.searchFields from TCA, then to the label field. Only whitelisted TCA columns are accepted.
maxResults int 20 Maximum number of AJAX search results. Hard cap: 200.
previewImage string — FAL field on the foreign table whose first image is shown as a 64×64 thumbnail instead of the record icon.
allowRootLevel bool false When true, non-admin editors can see records stored at pid=0 (site root level). Admin users always have access regardless of this setting.
allowRemoveInaccessible bool true When true (default), the remove button is shown for inaccessible records, but clicking it opens a TYPO3 confirmation modal warning that the selection cannot be restored. When false, the remove button is hidden entirely for inaccessible records.

Naming convention: All options added by this extension follow lowerCamelCase (infoFields, searchFields, maxResults, previewImage, allowRootLevel), consistent with newer TYPO3 core TCA options like renderType. The older core options minitems, maxitems, and foreign_table keep their original spelling.

Example: address record selector

The selected card will show three lines:

  1. ID: 42 · PID: 5 · /contacts/
  2. Stadt: London · E-Mail: [email protected] (editor's language)
  3. City: London · Email: [email protected] (default language, only when different)

Language Handling

The element stores the default-language UID (sys_language_uid = 0) of the selected record — consistent with how TYPO3 handles language overlays throughout the system.

Display is language-aware:

Cross-language search

The AJAX search always runs two queries:

  1. Default-language records matching the search term
  2. Translation records (in any language) matching the search term → their default-language parent records are returned

This means editors can search in any language regardless of their backend language setting. A German editor searching for "Müller" will find the contact even when the backend is set to English.


Hidden Record Indicators

The element shows a badge on the record title to indicate visibility problems:

Badge Color Meaning
hidden yellow The default-language record and the editor's language translation are both hidden — or no translation exists and the default record is hidden
partially hidden grey One side is hidden: either the default-language record is hidden but the translation is visible, or the translation is hidden but the default record is visible
(none) — All checked versions are visible

Scope of the check

The check covers exactly two records:

  1. The default-language record — the one whose UID is stored in the field
  2. The translation in the editor's display language — resolved via BackendUtility::getRecordLocalization()

Hidden states of other language versions (e.g. a French translation when a German editor is working) are intentionally not checked. TYPO3's language model is hierarchical: the default-language record is the anchor, and editors are responsible for the language versions they work in. Checking all translations would require one extra DB query per result row, and surfacing a badge about a language the editor cannot even see in this context would be more confusing than helpful.

If a complete multi-language visibility check is required for a project, the resolvePreviewImageUrl approach — fetching all translation records in a single query — could be extended to also collect all hidden flags.


Security

The element enforces TYPO3 backend permissions at two levels:

Table-level: The backend user must have tables_select permission for the foreign table. Requests for unknown or inaccessible tables are rejected with HTTP 400. The edit link on selected cards is hidden when the editor lacks tables_modify permission.

Page-level: Before running any record queries, the endpoint determines which pages (PIDs) the backend user may read. It first collects the distinct PIDs that contain matching records, then checks each one:

  1. isInWebMount() — fast in-memory check against the user's configured web mounts
  2. readPageAccess() — full page-permission DB check, only for pages that pass step 1

Records on inaccessible pages are excluded from all queries, not filtered after the fact. This ensures the result limit (maxResults) is not consumed by records the editor cannot see.

Root-level records (pid=0) are restricted to admin users by default. Set allowRootLevel=true in TCA to allow non-admin access.

Security-relevant settings (allowRootLevel, allowRemoveInaccessible) are baked into the server-generated HTML at render time and are never sent as client-controlled parameters.


How the AJAX Endpoint Works

The element registers a backend AJAX route (ajax_ot_recordselector_search) that accepts the following query parameters:

Parameter Description
table Target table name
search Search string (minimum 2 characters; multiple words are ANDed)
lang sys_language_uid of the record being edited (default: 0)
backendLang sys_language_uid of the backend user's preferred language (default: 0)
searchFields Comma-separated columns to search in (optional)
infoFields Comma-separated fields to include in the result info lines (optional)
maxResults Maximum number of results (optional, default: 20, hard cap: 200)
returnUrl URL to return to after editing a record (optional)
previewImageField FAL field name for preview thumbnail (optional)

The endpoint returns a JSON array:

Security: only columns listed in $GLOBALS['TCA'][$table]['columns'] are accepted as search fields (whitelist approach). Access is checked against TYPO3 backend user permissions (tables_select).


License

GPL-2.0-or-later — see LICENSE

Author

Oliver Thiele — oliver-thiele.de


All versions of ot-recordselector with dependencies

PHP Build Version
Package Version
Requires php Version >=8.4
typo3/cms-core Version ^14.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package oliverthiele/ot-recordselector contains the following files

Loading the files please wait ...