mirror of
https://github.com/flextype/flextype.git
synced 2025-08-08 06:06:45 +02:00
feat(fields): Add new field entries.fetch
for Entries API #492
This commit is contained in:
@@ -29,13 +29,14 @@ declare(strict_types=1);
|
||||
foreach (flextype('entries')->getStorage('fetch.data.entries.fetch') as $field => $body) {
|
||||
|
||||
if (isset($body['method']) &&
|
||||
str_contains($body['method'], 'fetch') &&
|
||||
strpos($body['method'], 'fetch') !== false &&
|
||||
is_callable([flextype('entries'), $body['method']])) {
|
||||
$fetchFromCallbackMethod = $body['method'];
|
||||
} else {
|
||||
$fetchFromCallbackMethod = 'fetch';
|
||||
}
|
||||
|
||||
|
||||
$result = isset($body['result']) && in_array($body['result'], ['toArray', 'toObject']) ? $body['result'] : $resultTo;
|
||||
|
||||
$data[$field] = flextype('entries')->{$fetchFromCallbackMethod}($body['id'],
|
||||
|
Reference in New Issue
Block a user