Compare commits

...

2 Commits

Author SHA1 Message Date
buttle 73158ecf59 removes duplicate title element from block 2021-06-27 15:12:30 +02:00
buttle ca58dad9a2 fix media set data error. trim identifier 2021-06-27 13:30:17 +02:00
2 changed files with 6 additions and 12 deletions

View File

@ -10,14 +10,6 @@ class SketchfabBlockForm extends Form
public function init()
{
$this->add([
'name' => 'o:block[__blockIndex__][o:data][title]',
'type' => Element\Text::class,
'options' => [
'label' => 'Title (option)',
]
]);
$this->add([
'name' => 'o:block[__blockIndex__][o:data][width]',
'type' => Element\Number::class,
@ -47,6 +39,6 @@ class SketchfabBlockForm extends Form
'label' => 'Sub-title',
]
]);
}
}

View File

@ -52,11 +52,12 @@ class SketchfabMediaIngester implements IngesterInterface
$errorStore->addError('o:identifier', 'No identifier specified');
return;
}
$url = 'https://sketchfab.com/oembed/?url=' . $data['o:identifier'];
$identifier = trim($data['o:identifier']);
$url = 'https://sketchfab.com/oembed/?url=' . $identifier;
$response = $this->client->setUri($url)->send();
if (!$response->isOk()) {
$errorStore->addError('o:source', sprintf(
'Cannot find model URL: '.$data['o:identifier'],
'Cannot find model URL: ' . $identifier,
$response->getReasonPhrase(),
$response->getStatusCode()
));
@ -68,8 +69,9 @@ class SketchfabMediaIngester implements IngesterInterface
if ($tempFile) {
$tempFile->mediaIngestFile($media, $request, $errorStore, false);
}
// Set the Media source and data.
$media->setSource($data['o:source']);
$media->setData($response_body, true));
$media->setData(json_decode($response->getBody(), true));
}
}