Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/services/Process.php
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,19 @@ public function processFeed($step, $feed, &$processedElementIds)
// Set the attributes for the element
$element->setAttributes($attributeData, false);

// We can opt-out of populating certain fields
$skipFieldHandles = Plugin::$plugin->service->getConfig('skipFieldHandles', $feed['id']);

if ($skipFieldHandles) {
$feed['fieldMapping'] = array_filter($feed['fieldMapping'], function ($fieldInfo, $fieldHandle) use ($skipFieldHandles) {
$skip = in_array($fieldHandle, $skipFieldHandles);
if ($skip) {
Plugin::info('Skipped `{field}` due to config setting.', ['field' => $fieldHandle]);
}
return !$skip;
}, ARRAY_FILTER_USE_BOTH);
}

// Then, do the same for custom fields. Again, this should be done after populating the element attributes
foreach ($feed['fieldMapping'] as $fieldHandle => $fieldInfo) {
if (Hash::get($fieldInfo, 'field')) {
Expand Down