PHP code example of ithilgers / api-export
1. Go to this page and download the library: Download ithilgers/api-export 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/ */
ithilgers / api-export example snippets
final class AddPriceToFeed
{
public function __invoke(ModifyFeedItemEvent $event): void
{
if ($event->getResource() === 'events') {
$item = $event->getItem();
$item['price'] = (float)$event->getRecord()['price'];
$event->setItem($item);
}
}
}
// Configuration/TCA/Overrides/tx_apiexport_domain_model_feed.php
$GLOBALS['TCA']['tx_apiexport_domain_model_feed']['columns']['resource']['config']['items'][] =
['label' => 'Addresses', 'value' => 'addresses'];
$GLOBALS['TCA']['tx_apiexport_domain_model_feed']['columns']['settings']['config']['ds']['addresses'] =
'FILE:EXT:sitepackage/Configuration/FlexForms/ApiExportAddresses.xml';