Models
The Anthology extension is designed to be a generic tool for displaying records from any database table. To achieve this, you must explicitly tell the extension which model you want it to work with. The Quick Start guide provides a brief overview, whilst this guide explains the concepts in more detail.
Making a model available involves three key parts: the TCA, the Repository, and the TypoScript configuration.
The TCA File
At a minimum, you need a ctrl section in your TCA file with a title. This title is what will appear in the plugin's "Model name" selection box.
Here is a minimal example for a hypothetical table named tx_:
Configuration/TCA/tx_myextension_domain_model_item.php
<?php
return [
'ctrl' => [
'title' => 'My Extension Items',
'label' => 'title',
'tstamp' => 'tstamp',
'crdate' => 'crdate',
// ... other necessary ctrl properties
'iconfile' => 'EXT:my_extension/Resources/Public/Icons/Item.svg',
],
// ... rest of your TCA ...
];
The Repository
To fetch the data from your table, the Anthology extension needs a corresponding Extbase repository. This repository must have the Liquid attribute with the corresponding TCA/table name argument.
Classes/Domain/Repository/ItemRepository.php
<?php
declare(strict_types=1);
namespace Vendor\MyExtension\Domain\Repository;
use LiquidLight\Anthology\Attribute\AsAnthologyRepository;
use TYPO3\CMS\Extbase\Persistence\Repository;
#[AsAnthologyRepository('tx_myextension_domain_model_item')]
class ItemRepository extends Repository
{
// You can add custom finder methods here if needed
}
Select the Model in the Plugin
After completing the steps above and clearing the cache, your new model will be available for selection in the Anthology plugin.
- Edit the Anthology content element on your page.
- Navigate to the General tab.
- Click on the Model name dropdown menu.
- You should now see "My Extension Items" (the
titlefrom your TCA file) as an option.
Once you select it and save the content element, the plugin will start to query and display the records from your tx_ table.