-
Notifications
You must be signed in to change notification settings - Fork 2
Added replicator support in templates #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…ta into feature/replicator-support
…ta into feature/replicator-support
| } | ||
| } | ||
|
|
||
| return $field['value'] ?? null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe use a match?
$type = $field['type'] ?? null;
return match (true) {
$type === 'array' && isset($field['values']) => $field['values'],
$type === 'object' && isset($field['value']) => $field['value'],
$type === 'object_array' && isset($field['values']) => $field['values'],
$type === 'numeric'
&& isset($field['value'])
&& is_numeric($field['value']) => (float) $field['value'],
default => $field['value'] ?? null,
};| return match ($type) { | ||
| 'replicator_object_array' => new ReplicatorObjectArrayTransformer, | ||
| default => new DefaultFieldTransformer, | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This just has one condition, then i'd make it an if
| */ | ||
| protected function extractFieldData($setFieldKey, $setFieldData): ?array | ||
| { | ||
| // Handle list array format: [['handle' => 'text', 'field' => [...]]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only comments in this function? 😜 I think they can be removed
No description provided.