PHP code example of heimrichhannot / contao-entity-import-bundle
1. Go to this page and download the library: Download heimrichhannot/contao-entity-import-bundle library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
heimrichhannot / contao-entity-import-bundle example snippets
class SourceFactoryCreateSourceEventListener {
public function __invoke(SourceFactoryCreateSourceEvent $event) {
$sourceModel = $event->getSourceModel();
$source = $event->getSource();
switch ($sourceModel->type) {
case 'new_stuff':
$source = new NewStuffSource();
break;
// ...
}
$event->setSource($source);
}
}
$dca = &$GLOBALS['TL_DCA']['tl_entity_import_source'];
$dca['fields']['type']['options'] = array_merge($dca['fields']['type']['options'], [
'new_stuff'
]);