Compare commits

..

No commits in common. "73158ecf59cc0bde7c5fa3920d388b496364f478" and "f633eeb52934ead97e37692be2d507d70f01cc00" have entirely different histories.

2 changed files with 12 additions and 6 deletions

View File

@ -10,6 +10,14 @@ 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,

View File

@ -52,12 +52,11 @@ class SketchfabMediaIngester implements IngesterInterface
$errorStore->addError('o:identifier', 'No identifier specified'); $errorStore->addError('o:identifier', 'No identifier specified');
return; return;
} }
$identifier = trim($data['o:identifier']); $url = 'https://sketchfab.com/oembed/?url=' . $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: ' . $identifier, 'Cannot find model URL: '.$data['o:identifier'],
$response->getReasonPhrase(), $response->getReasonPhrase(),
$response->getStatusCode() $response->getStatusCode()
)); ));
@ -69,9 +68,8 @@ 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(json_decode($response->getBody(), true)); $media->setData($response_body, true));
} }
} }