Skip to content

Commit

Permalink
Update field keys method
Browse files Browse the repository at this point in the history
  • Loading branch information
vinkla committed Oct 17, 2023
1 parent 993f6e4 commit 2838745
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Fields/Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ public function dd(...$args): never
}

/**
* It is recommended to let the package generate the key for you and in most
* cases, there is no need to set a custom key, so try to avoid it. Please
* use this method with caution.
* Avoid using custom field keys unless you thoroughly understand them. The
* field keys are automatically generated when you use the
* `register_extended_field_group` function.
* @throws \InvalidArgumentException
*/
public function key(string $key): static
Expand Down Expand Up @@ -110,21 +110,21 @@ public function get(string|null $parentKey = null): array

if (isset($this->settings['conditional_logic'])) {
$this->settings['conditional_logic'] = array_map(
fn($rules) => $rules->get($parentKey),
fn ($rules) => $rules->get($parentKey),
$this->settings['conditional_logic']
);
}

if (isset($this->settings['layouts'])) {
$this->settings['layouts'] = array_map(
fn($layout) => $layout->get($key),
fn ($layout) => $layout->get($key),
$this->settings['layouts']
);
}

if (isset($this->settings['sub_fields'])) {
$this->settings['sub_fields'] = array_map(
fn($field) => $field->get($key),
fn ($field) => $field->get($key),
$this->settings['sub_fields']
);
}
Expand Down

0 comments on commit 2838745

Please sign in to comment.