Skip to content

Commit

Permalink
tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
i-just committed Sep 19, 2024
1 parent 99ee05c commit 1801b9b
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/models/FieldLayout.php
Original file line number Diff line number Diff line change
Expand Up @@ -822,15 +822,17 @@ public function getCardBodyElements(?ElementInterface $element = null, array $ca
foreach ($cardElements as $cardElement) {
if (str_starts_with($cardElement['value'], 'layoutElement:')) {
$uid = str_replace('layoutElement:', '', $cardElement['value']);
$fieldId = $cardElement['fieldId'];
$element = $this->getElementByUid($uid);
if ($element === null) {
$field = Craft::$app->getFields()->getFieldById($fieldId);
$element = new CustomField();
$element->setField($field);
$layoutElement = $this->getElementByUid($uid);
if ($layoutElement === null) {
$fieldId = $cardElement['fieldId'];
if ($fieldId) {
$field = Craft::$app->getFields()->getFieldById($fieldId);
$layoutElement = new CustomField();
$layoutElement->setField($field);
}
}

$layoutElements[$cardElement['value']] = $element;
$layoutElements[$cardElement['value']] = $layoutElement;
}
}
}
Expand Down

0 comments on commit 1801b9b

Please sign in to comment.