Compare commits
2 Commits
f633eeb529
...
73158ecf59
Author | SHA1 | Date |
---|---|---|
buttle | 73158ecf59 | |
buttle | ca58dad9a2 |
|
@ -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,
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue