mirror of
https://github.com/flextype/flextype.git
synced 2025-08-08 06:06:45 +02:00
feat(media): Add new field media.folders.fetch
and media.files.fetch
for Media Folders and Files API #501 #500
This commit is contained in:
@@ -62,7 +62,7 @@ flextype()->get('/api/media/files', function (Request $request, Response $respon
|
||||
$id = $query['id'];
|
||||
$token = $query['token'];
|
||||
$options = $query['options'] ?? [];
|
||||
$method = $query['method'] ?? '';
|
||||
$method = $query['options']['method'] ?? '';
|
||||
|
||||
if (flextype('registry')->get('flextype.settings.api.media.files.enabled')) {
|
||||
// Validate delivery token
|
||||
|
@@ -29,10 +29,10 @@ if (flextype('registry')->get('flextype.settings.entries.fields.media.files.fetc
|
||||
// Modify fetch.
|
||||
foreach (flextype('entries')->getStorage('fetch.data.media.files.fetch') as $field => $body) {
|
||||
|
||||
if (isset($body['method']) &&
|
||||
strpos($body['method'], 'fetch') !== false &&
|
||||
is_callable([flextype('media')->files(), $body['method']])) {
|
||||
$fetchFromCallbackMethod = $body['method'];
|
||||
if (isset($body['options']['method']) &&
|
||||
strpos($body['options']['method'], 'fetch') !== false &&
|
||||
is_callable([flextype('media')->files(), $body['options']['method']])) {
|
||||
$fetchFromCallbackMethod = $body['options']['method'];
|
||||
} else {
|
||||
$fetchFromCallbackMethod = 'fetch';
|
||||
}
|
||||
@@ -78,10 +78,10 @@ if (flextype('registry')->get('flextype.settings.entries.fields.media.folders.fe
|
||||
// Modify fetch.
|
||||
foreach (flextype('entries')->getStorage('fetch.data.media.folders.fetch') as $field => $body) {
|
||||
|
||||
if (isset($body['method']) &&
|
||||
strpos($body['method'], 'fetch') !== false &&
|
||||
is_callable([flextype('media')->folders(), $body['method']])) {
|
||||
$fetchFromCallbackMethod = $body['method'];
|
||||
if (isset($body['options']['method']) &&
|
||||
strpos($body['options']['method'], 'fetch') !== false &&
|
||||
is_callable([flextype('media')->folders(), $body['options']['method']])) {
|
||||
$fetchFromCallbackMethod = $body['options']['method'];
|
||||
} else {
|
||||
$fetchFromCallbackMethod = 'fetch';
|
||||
}
|
||||
|
Reference in New Issue
Block a user