I’d like to customize the exhibits browse page in my theme, to display my exhibits list containing only two information for every exhibit: the exhibit title and the content of selected page block (text only).
I tried to use the function
exhibit_builder_render_exhibit_page() that is used in the exhibit show.php but I don’t know how to specify the parameter to select particular page.
I’m thinking about something like:
metadata('exhibit_page', ...??? ) but it is not fully documented, how to select specific page content.
Using for example
echo metadata('exhibit_page', 'title') inside the exhibits browse page I get Omeka_View_Exception.
Probably I need to use something like
set_current_record(..) first, but no idea what parameters should I pass, and the function documentation is very ascetic.
Any help highly appreciated.
The tricky bit will definitely be getting the correct page block. There’s not really a good way to select which block you want to use, so you’d have to do some checking hardcoded into the theme file to figure it out.
If you are in the simple case of wanting the first block of the first page for each exhibit, you could do something like this inside where it loops through the exhibits:
<?php foreach (loop('exhibit') as $exhibit): ?> // other stuff for displaying info snpped out <?php $pages = $exhibit->getPages(); $firstPage = $pages; $blocks = $firstPage->getPageBlocks(); $firstBlock = $blocks; $blockText = metadata($firstBlock, 'text'); ?> <div><?php echo $blockText; ?></div> <?php endforeach; ?>
For anything more nuanced, you’d probably have to directly look up the block from the table, assuming that you can dig up the block id and hard code a check against the exhibit id to get the one you want. But, hopefully the above will be a start.