TCA Override
Basic
Each Content Element type has to be registered for dataflow via TCA Overrides .
This is done with the function addDataflowFieldsToContentElement from
- addDataflowFieldsToContentElement ( $cType, $foreignTable, $configuration)
-
- param string $cType
-
CType of the content element.
- param string $foreignTable
-
Table name of the foreign table.
- param bool $enablePagination
-
Activates pagination options in Backend and outputs paginated elements.
- param array $configuration
-
Advanced configuration.
- param array $configuration['foreignSortableColumns']
-
Whitelist of columns which are selectable for sorting.
- param array $configuration['foreignConstraints']
\Jar\Dataflow\Utilities\DataflowUtility::addDataflowFieldsToContentElement('html', 'tx_j77template_utility_jobs', [
'enablePagination' => true,
// you could write contraints directly as string, be careful when using dynamic values! No Escaping will be used here!
'foreignConstraints' => [
'`tx_j77template_utility_jobs`.`jobtype` = 12345'
]
]);
Copied!
For developers
array $foreignConstraints
-
- param bool $userFunc
-
userFunc
- param bool $parameters
-
Parameters for the userFunc.
\Jar\Dataflow\Utilities\DataflowUtility::addDataflowFieldsToContentElement('html', 'tx_j77template_utility_jobs', [
'foreignConstraints' => [
[
'userFunc' => \EXT\CustomNamespace\Constraints\CustomConstraints::class . '->getListConstraints',
'parameters' => [
'hello' => 'world'
]
]
]
]);
Copied!
| | The userFunc can be used to add custom contraints for the crawled items. | E.g. all items with the uid greater 1330 and less than 1432. |
/**
* @param ExpressionBuilder $expressionBuilder
* @param array $params
* @return array
*/
public function getListConstraints(ExpressionBuilder $expressionBuilder, array $params = []): array {
$table = $params['table'];
$result = [
$expressionBuilder->gte($table . '.uid', 1331),
$expressionBuilder->lte($table . '.uid', 1431)
];
return $result;
}
Copied!