This package allows you to quickly create backend modules for advanced record listing.
Optional workspaces integration: More simple workflow for requesting and approving changes.
- List records from any table
- Filter records by any field
- Sort records by any field
- Configurable + sortable columns
- Inline editing support
composer require xima/xima-typo3-recordlist
Start by creating a new backend controller in your TYPO3 extension.
The controller implements the BackendControllerInterface
which requires you to add the
methods getTableName()
and getRecordPid()
:
<?php
// EXT:my_extension/Classes/Controller/UserController.php
namespace Vendor\MyExtension\Controller\Backend;
use Xima\XimaTypo3Recordlist\Controller\AbstractBackendController;
class UserController extends AbstractBackendController
{
public function getTableName(): string
{
return 'fe_users';
}
public function getRecordPid(): int
{
return $this->site->getConfiguration()['userPid'] ?? 0;
}
}
Add a new backend module via
the Backend module API.
You're free to adjust the settings as you like, the only important setting is the controllerActions
, which needs to point to your newly
created controller:
<?php
// EXT:my_extension/Configuration/Backend/Modules.php
use Xima\XimaTypo3Recordlist\Controller\ExamplePagesController;
return [
'example_pages' => [
'parent' => 'web',
'position' => ['after' => 'list'],
'access' => 'user',
'iconIdentifier' => 'module-cshmanual',
'workspaces' => '*',
'labels' => 'LLL:EXT:xima_typo3_recordlist/Resources/Private/Language/locallang_pages_module.xlf',
'extensionName' => 'MyExtension',
'controllerActions' => [
ExamplePagesController::class => [
'processRequest',
],
],
'inheritNavigationComponentFromMainModule' => false,
],
];
To use the template and partials, you need to add the template path to your sitepackge with TSconfig:
# EXT:my_extension/Configuration/page.tsconfig
templates.vendor/my-extension.1740563365 = xima/xima-typo3-recordlist:Resources/Private/
That's it. You can find working examples in the Example directory.
To a customize the template, partials or sections, you need to configure an additional template path in your TSconfig:
# EXT:my_extension/Configuration/page.tsconfig
templates.vendor/my-extension.1740570140 = my-vendor/my-extension:Resources/Private/TemplateOverrides
Inside your TemplateOverrides folder, create a templates
directory, copy the Default.html file
into it and adjust it to your needs.
In case you have multiple backend modules, you can adjust the template name by overriding the TEMPLATE_NAME
constant in your controller:
<?php
class UserController extends AbstractBackendController
{
protected const TEMPLATE_NAME = 'Custom';
}
Each record item can be modified using the modifyRecord
method:
class UserController extends AbstractBackendController
{
public function modifyRecord(array &$record): void
{
$record['fullName'] = $record['first_name'] . ' ' . $record['last_name'];
}
}
Add new filter options
class UserController extends AbstractBackendController
{
public function modifyQueryBuilder(): void
{
if (isset($body['register_date']) && $body['register_date']) {
$registerDate = new DateTime($body['register_date']);
$this->additionalConstraints[] = $this->queryBuilder->expr()->gte('register_date', $registerDate->getTimestamp());
}
}
}
To change the default columns, you can override the modifyTableConfiguration
method:
<?php
class NewsController extends AbstractBackendController
{
public function modifyTableConfiguration(): void
{
$this->tableConfiguration['columns']['fal_media']['defaultPosition'] = 2;
$this->tableConfiguration['columns']['author']['defaultPosition'] = 3;
$this->tableConfiguration['columns']['sitemap_changefreq']['defaultPosition'] = 4;
$this->tableConfiguration['columns']['sys_language_uid']['defaultPosition'] = 5;
$this->tableConfiguration['columns']['workspace-status']['defaultPosition'] = 6;
}
}
To add custom columns, you can override the modifyTableConfiguration
method:
<?php
class UserController extends AbstractBackendController
{
public function modifyTableConfiguration(): void
{
// make title field inline editiable
$this->tableConfiguration['columns']['title']['partial'] = 'TextInlineEdit';
}
}
For easy development, you can use the provided ddev setup. Simply run ddev start
and open the URL in your browser.
After a composer install
, you can run ddev init-typo3
to setup a TYPO3 installation with example data. Login with admin
/ Passw0rd!
and editor
/ Passw0rd!
.