ichhabrecht / t3tags
Generate tag fields for every record type
Installs: 1 136
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 3
Forks: 5
Open Issues: 2
Type:typo3-cms-extension
Requires
- php: >= 7.0, < 7.4
- typo3/cms-core: ^8.7 || ^9.5
Requires (Dev)
- nimut/testing-framework: 4.x-dev
Replaces
- typo3-ter/t3tags: 1.0.1
This package is auto-updated.
Last update: 2024-11-06 06:29:49 UTC
README
Generate tag fields for every record type.
Features
- Integrates into Core API and extends
group
field behaviour - New tags can be added on the fly and are created only when the record is saved
- New tags that are added to multiple (tag) fields are created only once in database
Installation
- Simply install the extension with Composer or the Extension Manager.
composer require ichhabrecht/t3tags
- In the extension settings configure a page uid, where tags should be stored.
Usage
Register a new field using the TagRegistry
- Add or extend a file in Configuration/TCA/Overrides
<?php
defined('TYPO3_MODE') || die();
(function () {
$tagRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\IchHabRecht\T3tags\Configuration\TagRegistry::class);
$tagRegistry->makeTaggable(
'tt_content',
'relevant_tags',
[
'label' => 'Relevant tags',
'position' => 'after:--palette--;;access',
'fieldConfiguration' => [
'maxitems' => 5,
'fieldInformation' => [
'tagInformation' => [
'options' => [
'labels' => [
0 => [
'label' => 'Add here up to five super relevant tags',
],
],
],
],
],
],
]
);
$tagRegistry->makeTaggable(
'tt_content',
'content_tags',
[
'label' => 'Content tags',
'position' => 'after:relevant_tags',
'fieldConfiguration' => [
'fieldInformation' => [
'tagInformation' => [
'options' => [
'labels' => [
0 => [
'label' => 'Add here unlimited content tags that describe your topic and the content detail',
],
],
],
],
],
],
]
);
})();
Parameters
- Table name: Existing TCA table that should be extended
- Field name: Name of the new tag field that should be added
- Options: Additional field configuration, according to TCA field configuration
- label
- exclude
- fieldConfiguration (config)
- l10n_display
- l10n_mode
- displayCond
- position
- interface
- fieldList
- typesList
- override: True, if any existing field configuration should be replaced with the one provided
Get all tags for a record by field
$tagRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\IchHabRecht\T3tags\Domain\Repository\TagRepository::class);
$tagRepository->findTagsByField('tt_content', 'relevant_tags', 42);
- Returns all tags (as array) from a
tt_content
element with uid42
and its fieldrelevant_tags
Get all tags by record
$tagRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\IchHabRecht\T3tags\Domain\Repository\TagRepository::class);
$tagRepository->findTagsByRecord('tt_content', 42);
- Returns all tags (as array) from a
tt_content
element with uid42
. According to the example registration from above, tags fromrelevant_tags
andcontent_tags
are returned.