1
0
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:
Awilum
2020-12-18 22:36:12 +03:00
parent 43727e1796
commit 5b1713d14c
2 changed files with 9 additions and 9 deletions

View File

@@ -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

View File

@@ -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';
}