Skip to content

Commit 0bc5f7e

Browse files
authored
Merge pull request #18070 from craftcms/bugfix/propagate-required-and-field
don't assume we have a field
2 parents 02be70d + a42714a commit 0bc5f7e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/elements/NestedElementManager.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -858,7 +858,7 @@ private function saveNestedElements(ElementInterface $owner): void
858858
$this->propagationMethod !== PropagationMethod::All &&
859859
($owner->propagateAll || !empty($owner->newSiteIds))
860860
) ||
861-
($owner->propagateRequired && $this->field->layoutElement->required)
861+
($owner->propagateRequired && $this->field?->layoutElement->required)
862862
) {
863863
// Find the owner's site IDs that *aren't* supported by this site's nested elements
864864
$ownerSiteIds = array_map(
@@ -925,7 +925,7 @@ private function saveNestedElements(ElementInterface $owner): void
925925
// its elements have been replaced by the other sites’ nested elements
926926
if ($owner->propagateAll) {
927927
$this->duplicateNestedElements($owner, $localizedOwner, force: true);
928-
} elseif ($owner->propagateRequired && $this->field->layoutElement->required) {
928+
} elseif ($owner->propagateRequired && $this->field?->layoutElement->required) {
929929
// if we're propagating required and the field is required, and it doesn't validate because of this field,
930930
// duplicate like above
931931
$localizedOwner->setScenario(Element::SCENARIO_LIVE);

0 commit comments

Comments
 (0)