adds renderer

This commit is contained in:
buttle 2021-06-22 11:37:19 +02:00
parent 421b71c9d8
commit 92da216cff
6 changed files with 12 additions and 55 deletions

View File

@ -9,18 +9,6 @@ class Module extends AbstractModule
{ {
const NAMESPACE = __NAMESPACE__; const NAMESPACE = __NAMESPACE__;
const MEDIA_TYPE = [
'video' => 'Video',
'audio' => 'Audio',
'image' => 'Image',
];
const RATIOS = [
'1.777' => '16:9',
'1.333' => '4:3',
'2' => '2:1',
];
public function getConfig() public function getConfig()
{ {
return include __DIR__ . '/config/module.config.php'; return include __DIR__ . '/config/module.config.php';

View File

@ -1,6 +1,6 @@
# Sketchfab models for Omeka S # Sketchfab models for Omeka S
[Sketchfab] is a module for [Omeka S] that integrates Sketchfab [Sketchfab-omeka-module] is a module for [Omeka S] that integrates Sketchfab
3D models. 3D models.
## Install ## Install
@ -9,7 +9,7 @@
cd ./modules cd ./modules
https://git.hangar.org/arcHIVE-tech/Sketchfab-omeka-module.git https://git.hangar.org/arcHIVE-tech/Sketchfab-omeka-module.git
unzip main.zip unzip main.zip
mv archiveorg/ Sketchfab mv sketchfab-omeka-module Sketchfab
rm main.zip rm main.zip
``` ```
@ -18,9 +18,8 @@ The module is released under the [MIT] License.
[arc-hive]: https://arc-hive.zone/ [arc-hive]: https://arc-hive.zone/
[Archive.org media ]: https://git.hangar.org/arcHIVE-tech/Sketchfab [Sketchfab-omeka-module]: https://git.hangar.org/arcHIVE-tech/Sketchfab-omeka-module
[Omeka S]: https://omeka.org/s [Omeka S]: https://omeka.org/s
[Archive.org]: https://archive.org
[MIT]: http://opensource.org/licenses/MIT [MIT]: http://opensource.org/licenses/MIT

View File

@ -29,11 +29,8 @@ return [
], ],
'DefaultSettings' => [ 'DefaultSettings' => [
'SketchfabBlockForm' => [ 'SketchfabBlockForm' => [
'media_type' => 'video',
'title' => '', 'title' => '',
'width' => 600, 'width' => 600,
'ratio' => '2',
'autoLoad' => false,
'wrapStyle' => 'overflow-y: hidden;display: flex;flex-direction: column;justify-content: center;', 'wrapStyle' => 'overflow-y: hidden;display: flex;flex-direction: column;justify-content: center;',
] ]
] ]

View File

@ -18,15 +18,6 @@ class SketchfabBlockForm extends Form
] ]
]); ]);
$this->add([
'name' => 'o:block[__blockIndex__][o:data][media_type]',
'type' => Element\Select::class,
'options' => [
'label' => 'Media type',
'value_options' => Module::MEDIA_TYPE,
],
]);
$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,
@ -38,14 +29,5 @@ class SketchfabBlockForm extends Form
], ],
]); ]);
$this->add([
'name' => 'o:block[__blockIndex__][o:data][ratio]',
'type' => Element\Select::class,
'options' => [
'label' => 'Ratio',
'value_options' => Module::RATIOS,
],
]);
} }
} }

View File

@ -75,6 +75,12 @@ class Sketchfab extends AbstractBlockLayout
static $id = 0; static $id = 0;
$media = $attachments[0]->item()->media()[0]; $media = $attachments[0]->item()->media()[0];
return $view->partial('common/block-layout/sketchfab', [
'title' => false,
'sketchfab_iframe' => $media->mediaData()['html'],
]);
//return $media->mediaData()['html'];
/*
$width = $block->dataValue('width'); $width = $block->dataValue('width');
$height = $width / $block->dataValue('ratio'); $height = $width / $block->dataValue('ratio');
return $view->partial('common/block-layout/archiveOrg', [ return $view->partial('common/block-layout/archiveOrg', [
@ -86,5 +92,6 @@ class Sketchfab extends AbstractBlockLayout
'id' => 'achive_org-' . ++$id, 'id' => 'achive_org-' . ++$id,
'thumbnails' => $thumbnails, 'thumbnails' => $thumbnails,
]); ]);
*/
} }
} }

View File

@ -2,28 +2,12 @@
<?php <?php
if ($title !== false && $title !== "") { if ($title !== false && $title !== "") {
$title = sprintf('<p id="achive_org_media-title">%s</p>', $title); $title = sprintf('<p id="sketchfab-title">%s</p>', $title);
} else { } else {
$title = false; $title = false;
} }
?> ?>
<?php if ($media_type != "audio") { ?> <?= $sketchfab_iframe ?>
<style>
#<?= $id ?> {
height: <?= $height ?>px;
width: <?= $width ?>px;
}
</style>
<?php } ?>
<iframe
id="<?= $id ?>"
src="<?= $url ?>"
frameborder="0"
webkitallowfullscreen="true"
mozallowfullscreen="true"
allowfullscreen >
</iframe>
</div> </div>