Compare commits
2 Commits
f633eeb529
...
73158ecf59
Author | SHA1 | Date |
---|---|---|
buttle | 73158ecf59 | |
buttle | ca58dad9a2 |
|
@ -10,14 +10,6 @@ class SketchfabBlockForm extends Form
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->add([
|
|
||||||
'name' => 'o:block[__blockIndex__][o:data][title]',
|
|
||||||
'type' => Element\Text::class,
|
|
||||||
'options' => [
|
|
||||||
'label' => 'Title (option)',
|
|
||||||
]
|
|
||||||
]);
|
|
||||||
|
|
||||||
$this->add([
|
$this->add([
|
||||||
'name' => 'o:block[__blockIndex__][o:data][width]',
|
'name' => 'o:block[__blockIndex__][o:data][width]',
|
||||||
'type' => Element\Number::class,
|
'type' => Element\Number::class,
|
||||||
|
|
|
@ -52,11 +52,12 @@ class SketchfabMediaIngester implements IngesterInterface
|
||||||
$errorStore->addError('o:identifier', 'No identifier specified');
|
$errorStore->addError('o:identifier', 'No identifier specified');
|
||||||
return;
|
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();
|
$response = $this->client->setUri($url)->send();
|
||||||
if (!$response->isOk()) {
|
if (!$response->isOk()) {
|
||||||
$errorStore->addError('o:source', sprintf(
|
$errorStore->addError('o:source', sprintf(
|
||||||
'Cannot find model URL: '.$data['o:identifier'],
|
'Cannot find model URL: ' . $identifier,
|
||||||
$response->getReasonPhrase(),
|
$response->getReasonPhrase(),
|
||||||
$response->getStatusCode()
|
$response->getStatusCode()
|
||||||
));
|
));
|
||||||
|
@ -68,8 +69,9 @@ class SketchfabMediaIngester implements IngesterInterface
|
||||||
if ($tempFile) {
|
if ($tempFile) {
|
||||||
$tempFile->mediaIngestFile($media, $request, $errorStore, false);
|
$tempFile->mediaIngestFile($media, $request, $errorStore, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the Media source and data.
|
// Set the Media source and data.
|
||||||
$media->setSource($data['o:source']);
|
$media->setSource($data['o:source']);
|
||||||
$media->setData($response_body, true));
|
$media->setData(json_decode($response->getBody(), true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue