Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.

Commit

Permalink
fixed settings logo (#940)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lapsus authored and binal-7span committed May 15, 2019
1 parent ae5253c commit 77fb20f
Showing 1 changed file with 20 additions and 17 deletions.
37 changes: 20 additions & 17 deletions src/endpoints/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,25 +79,28 @@ public function all(Request $request, Response $response)
);

/**
* Generate the response object based on interface
*
* Generate the response object based on interface/type
*
*/
foreach($fieldData['data'] as $key => $value){
switch ($value['type']) {
case 'file':
$result = array_search($value['field'], array_column($responseData['data'], 'key'));
if($result){
if (!empty($responseData['data'][$result]['value'])) {
$fileInstence = $service->findFile($responseData['data'][$result]['value']);
$responseData['data'][$result]['value'] = !empty($fileInstence['data']) ? $fileInstence['data'] : null;
} else {
$responseData['data'][$result]['value'] = null;
foreach($fieldData['data'] as $fieldDefinition){
// find position of field in $response['data']
$index = array_search($fieldDefinition['field'], array_column($responseData['data'], 'key'));
if (false !== $index) {

switch ($fieldDefinition['type']) {
case 'file':
if (!empty($responseData['data'][$index]['value'])) {
$fileInstance = $service->findFile($responseData['data'][$index]['value']);
$responseData['data'][$index]['value'] = null;

if (!empty($fileInstance['data'])) {
$responseData['data'][$index]['value'] = $fileInstance['data'];
}
}
}
break;
case 'array':
$inputData['value'] = !empty($responseData['data'][$result]['value']) ? $responseData['data'][$result]['value'] : null;
break;
break;
default:
break;
}
}
}

Expand Down

0 comments on commit 77fb20f

Please sign in to comment.