Skip to content

Commit

Permalink
ensure field is set last on the layout element
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/fieldlayoutelements/CustomField.php
  • Loading branch information
i-just authored and brandonkelly committed Sep 20, 2024
1 parent bcffada commit d353ae5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/fieldlayoutelements/CustomField.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,16 @@ class CustomField extends BaseField
*/
public function __construct(?FieldInterface $field = null, $config = [])
{
$this->_field = $field;
// ensure we set the field last, so it has access to other properties that need to be set first
// see https://github.com/craftcms/cms/issues/15752
if (isset($config['fieldUid'])) {
$fieldUid = $config['fieldUid'];
unset($config['fieldUid']);
$config['fieldUid'] = $fieldUid;
}

parent::__construct($config);
$this->_field = $field;
}

/**
Expand Down

0 comments on commit d353ae5

Please sign in to comment.