Daniel-KM/Omeka-S-module-UniversalViewer

how to load universalviewer with some options?

m-art-in opened this issue · 6 comments

I have a problem to load the universal viewer in combination with an array $options.
Background: Depending on the language of my Omeka S Site, the viewer should be loaded with the corresponding language. For this I call the universalviewer manually in my theme in the file show.phtml. But I am unsure how I can / must pass the options.

in my Config.json (of universalviewer) I have defined 3 languages and corresponding language-config-files. which I could easly load on the webpage in the viewer's settings (works well):

"localisation": { "locales": [ { "name": "de-DE", "label": "German (DE)" }, { "name": "en-GB", "label": "English (GB)" }, { "name": "fr-FR", "label": "Français (FR)" } ] }

in the show.phmtl I have the language code of the page (de, en or fr) and try to call the viewer with:

echo $this->universalViewer($item, array('locale' => 'de-DE' ));

Unfortunately this does not work for me. What am I doing wrong? Is the array defined correctly, regarding the information from the config?
many thanks for help

Meanwhile i tried to load the options with this code:

$options=array('name' => 'de-DE', 'label' => "German (DE)" ); 
        json_encode($options);
echo $this->universalViewer($item, $options);

No success either....

The option in the helper are internal options, not the ones passed to the Universal Viewer. You need to update options manually in asset/vendor/uv for now.

Thank you for the explanation. Two questions come up:

  • If $options are the parameters for the handler, what can I change with it?

  • How should I proceed to achieve my goal (display Universalviewer in the respective language of the Omeka page)? I have already adjusted the file asset/universal-viewer/config.json so that 3 languages (EN, FR, DE) can be selected and also added/edited the corresponding translations in the folder asset/vendor/uv/lib.

How should I proceed? Could it work, e.g. to load with JavaScript a different language (uv-seadrgon-extention-XX.XX.config.json)? At what point can I do this and what would the call be?

For the handler, the main point is to pass the options transparently to the phtml that call the uv (https://github.com/Daniel-KM/Omeka-S-module-UniversalViewer/blob/master/view/common/helper/universal-viewer.phtml). This is the point where you can load a specific config too.

For the handler, the main point is to pass the options transparently to the phtml that call the uv (https://github.com/Daniel-KM/Omeka-S-module-UniversalViewer/blob/master/view/common/helper/universal-viewer.phtml). This is the point where you can load a specific config too.

Thanks! I made my changes there (copied the file to my theme) and I can set some options there, but they have no effekt to the viewer:
grafik

What do I do wrong?

Ok, i could change the array $options in the file https://github.com/Daniel-KM/Omeka-S-module-UniversalViewer/blob/master/view/common/helper/universal-viewer.phtml - and then call universalviewer!
Thanks for the hint!