Custom data handlers

It is possible to use a custom data handler instead of the standard \Cobweb\ExternalImport\Importer::handleArray() and \Cobweb\ExternalImport\Importer::handleXML(). The value declared as a custom data handler is a class name:

$GLOBALS['TCA']['some_table']['external']['general'][0]['data'] = Foo\MyExtension\DataHandler\CustomDataHandler::class;
Copied!

The class itself must implement the \Cobweb\ExternalImport\DataHandlerInterface interface, which contains only the handleData() method. This method will receive two arguments:

  • an array containing the raw data returned by the connector service
  • a reference to the calling \Cobweb\ExternalImport\Importer object

The method is expected to return a simple PHP array, with indexed entries, like the standard methods (\Cobweb\ExternalImport\Importer::handleArray() and \Cobweb\ExternalImport\Importer::handleXML()).