Skip to content

Commit

Permalink
Fix an error when a non-Formie field was mistakenly added to a form
Browse files Browse the repository at this point in the history
  • Loading branch information
engram-design committed Oct 23, 2024
1 parent 300a379 commit 12c99e1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
10 changes: 0 additions & 10 deletions src/fields/Forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,6 @@ class Forms extends BaseRelationField
// Public Methods
// =========================================================================

public function __construct($config = [])
{
// Fix an error (not sure of cause...)
if (array_key_exists('formId', $config)) {
unset($config['formId']);
}

parent::__construct($config);
}

/**
* @inheritdoc
*/
Expand Down
4 changes: 2 additions & 2 deletions src/services/Fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -901,8 +901,8 @@ public function createField($config): FieldInterface
}

try {
$field = ComponentHelper::createComponent($config, FieldInterface::class);
} catch (MissingComponentException $e) {
$field = ComponentHelper::createComponent($config, FormFieldInterface::class);
} catch (InvalidConfigException | MissingComponentException $e) {
$config['errorMessage'] = $e->getMessage();
$config['expectedType'] = $config['type'];
unset($config['type']);
Expand Down

0 comments on commit 12c99e1

Please sign in to comment.