Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

order of events for setting enabled & enabledForSite #1381

Merged
merged 1 commit into from
Nov 25, 2023
Merged
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
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