Different viewers for different item types


#1

Hi there. I’m putting together a site using Omeka Classic, Berlin Theme. I know a bare minimum of PHP and have been muddling through code changes, but I’ve run into something I can’t solve with my current skill level. Is it possible to change how Item pages display files based on item type? I’d like to use Universal Viewer for still images and text, and Omeka’s default player for audio and video. That would also mean hiding the “File” field when the Universal Viewer is active so that files aren’t displaying twice. Any help, hints, and suggestions are most welcome. Thank you!


#2

Using the metadata function you can get the name of the item type of the current item:

$itemType = metadata('item', 'item_type_name');

Then you can use just regular if constructs in the items/show.php file to change how things display based on the item type.


#3

Thank you, that was just what I needed to get started! Now I’m just hung up on the code to conditionally display or hide the “Files” field. I’m familiar with the display property in CSS, but not sure how to translate that to PHP.


#4

Instead of using CSS you can just not render the stuff you don’t want at all… Find the part of the view that shows the files and wrap it in an appropriate if block.