DEPRECATION WARNING
This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.
Developer manual¶
This chapter describes some internals of this extension to let you extend it easily.
Assets such as PDF, images, documents, … are uploaded to TYPO3. Metadata extraction services are called, one after
another, based on their advertised priority or quality. These services are the various extraction classes you find under
Classes/Service/Extraction/
).
The service classes invoke the actual wrappers to the extraction tools (Apache Tika, ExifTool, PHP, …) to be found
under Classes/Service/Wrapper/
.
In order to map the data format used by the various extraction tools to the FAL metadata structure used by TYPO3, a
JSON-based configuration file is used. Those mapping configuration files can be found under
Configuration/Services/Wrapper/
.
JSON mapping configuration file¶
A mapping configuration file is of the form:
[
{
"FAL": "caption",
"DATA": "CaptionAbstract"
},
{
"FAL": "color_space",
"DATA": [
"ColorMode",
"ColorSpaceData",
"ColorSpace->Causal\\Extractor\\Utility\\ColorSpace::normalize"
]
}
]
- FAL
- This is the name (column) of the metadata in FAL.
- DATA
- This is either a unique key or an array of ordered keys to be checked for content in the extracted metadata. In
addition, an arbitrary post-processor may be specified using the
->
array notation.
Hook¶
The method \Causal\Extractor\Service\Extraction\AbstractExtractionService::getDataMapping()
is the central method
invoked to map extracted metadata to FAL properties. Developers may dynamically alter the mapping by hooking into the
process using $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extractor']['dataMappingHook']
.
Signal after extraction¶
Once the meta data has been extracted, a signal is emitted, which allows other extensions to process the file further.
The Signal can be connected to a Slot as follows (e.g. in file ext_localconf.php
of your extension).
// Initiate SignalSlotDispatcher
$signalSlotDispatcher = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'TYPO3\\CMS\\Extbase\\SignalSlot\\Dispatcher'
);
// Connect the Signal "postMetaDataExtraction" to a Slot
$signalSlotDispatcher->connect(
'Causal\\Extractor\\Service\\AbstractService',
'postMetaDataExtraction',
'Vendor\\MyExtension\\Service\\SlotService',
'dispatch'
);
This requires a PHP class \Vendor\MyExtension\Service\SlotService
and a method dispatch()
in this class.
The FAL $storageRecord
is passed as a parameter to the method.