Skip to content

Commit

Permalink
order of events for setting enabled & enabledForSite
Browse files Browse the repository at this point in the history
  • Loading branch information
i-just committed Nov 17, 2023
1 parent 503df96 commit a728231
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/services/Process.php
Original file line number Diff line number Diff line change
Expand Up @@ -369,9 +369,6 @@ public function processFeed($step, $feed, &$processedElementIds, $feedData = nul
}
}

// Set the attributes for the element
$element->setAttributes($attributeData, false);

$contentData = [];
if (isset($attributeData['enabled'])) {
// Set the site-specific status as well, but retain all other site statuses
Expand All @@ -390,8 +387,13 @@ public function processFeed($step, $feed, &$processedElementIds, $feedData = nul
$element->setEnabledForSite($enabledForSite);
$contentData['enabled'] = $element->enabled;
$contentData['enabledForSite'] = $element->getEnabledForSite($element->siteId);

unset($attributeData['enabled']);
}

// Set the attributes for the element
$element->setAttributes($attributeData, false);

// 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

0 comments on commit a728231

Please sign in to comment.