How can I access file metadata coming from the item's page

We were wondering how site users can access the file’s metadata page. So far, there are only thumbnails on the item’s page that users can open as full size images in a new tab. In the theme’s show.php I can find the following

<?php if ($hasImages): ?>
<?php foreach ($images as $itemFile): ?> <?php echo file_image('square_thumbnail', array(), $itemFile); ?> <?php endforeach; ?>
<?php endif; ?> <?php if ((count($nonImages) > 0) && get_theme_option('other_media') == 0): ?>
<?php foreach ($nonImages as $nonImage): ?>
    <?php echo file_markup($nonImage); ?>
<?php endforeach; ?>
<?php endif; ?> <?php echo all_element_texts('item'); ?>

I was wondering if I could change something here in order to make the file’s metadata page available to users or whether I have to change another show.php.

We need the file metadata to be accessible as it contains important information on where digitized archival documents come from.

There’s a “Link to File Metadata” option under Appearance -> Settings in 2.6 and newer that does this: if it’s enabled, the links to files become links to the files/show page instead.

Thank you very much for your reply. Unfortunately, it is enabled but users can still not access the file’s page.

Ah, sorry about that: that flag takes effect for the “default” display code only: when you’re using files_for_item or item_file_gallery.

Since you’re looping and using file_markup individually, that option doesn’t work. You can do file_markup($nonImage, array('linkToMetadata' => true)) to get those same links with the code you’re using instead.

What theme are you using, by the way? If that’s the normal code directly from the theme it’s a bug for it to not respect this setting, and we’ll make a new release fixing it so that the appearance setting works as expected.

We are using Center Row. The code that you can see above is the one directly from the theme. Thank you very much for your help!

We changed our theme to Northfield (based on Emiglio). Here we get the links to the file metadata page but we have another issue as the images and pdfs do not show anymore on the item page.
In the show.php, we can find this:

<?php echo metadata($item, array('Dublin Core', 'Title')); ?>

<?php if ((get_theme_option('Item FileGallery') == 0) && metadata('item', 'has files')): ?>
<div id="itemfiles" class="element">
    <?php echo files_for_item(array('imageSize' => 'fullsize')); ?>
<?php endif; ?>

If I change ‘fullsize’ to ‘thumbnail’, I can see the thumbnail on the item’s page. I am not sure what the issue is here, as the exact same images show up on the file’s page but not on the item’s page. We would like to show the full size images on the item page, as thumbnail is too small

Can you show a screenshot of the issue with “fullsize” on your other theme? Or even better, a link to the page?

Also, did you try the change I suggested to Center Row?

For the item page, the image does not show:

For the file page, the image appears:

I tried for Center Row but it did not work and we wanted to have a different layout with the image or pdf files being shown next to the metadata information, this is why we changed the theme. We like Northfield very much, the only issue remaining is the one with images on item pages.

The image is being displayed on that item page: it’s way down at the bottom of the right side. It looks like you just have the “item file gallery” option turned on in this theme’s settings.

true, it was as simple as that! Great, thank you so much for pointing that out!

I was going to ask the same question from this topic: I’m also trying to link the file’s page to the thumbnails in item’s page, but I’ve already tried to change the option in the Appearance > Settings and to change file_markup($nonImage, array(‘linkToMetadata’ => true)). None of them are working on 'The Daily’s theme. I’m wandering if I’m doing something wrong or changing the code in the wrong folder (thedaily/items/show.php). Can anyone help me?

Can you describe, with words or a screenshot, what part of the page you’re trying to link from? The Daily shows files a few different ways, and there are places like the “slider” where there currently isn’t a way to control how the linking works.

Thank you for your feedback.

The reason for my question is that I do not manage to access the metadata information associated to a file when the file is associated to an item.

In the exhibit I am building, the users are guided to items that have files associated to them.

I would like the user to have acess to the metadata that is associated to the file, when ckiling on the file thumbnail, in an item page.

I attached a screenshot to this message in order to make my question more visible . The screenshot link is:

Thank you in advance for your attention


I’ve tried to change the code, but it didn’t work.

<?php if ($hasImages): ?>
<?php foreach ($images as $itemFile): ?> <?php echo file_image('fullsize', array('linkToMetadata' => true), $itemFile); ?> <?php endforeach; ?>

This is just an issue with the “slider” being used there: it is pretty rigid with how it works, so you can’t really change where it links to.

We’re looking at some changes to our themes that use these slider components to allow for more customization like this, though.

1 Like

Thank you again for your answer.
I understant the limitations of the “slider”, but I tought that one solution to link file’s page to the item’s page would be to add a text with a link to the file’s page between the file’s thumbnail. But the problem is that I don’t know how to call the file’s page. The “uri” goes to the original file, not the page with the metadata.
Can you tell me if there’s a way to change that code so I can access the file’s page by clicking on the link? Here’s the code:

<?php foreach ($images as $itemFile): ?>
    <a href="<?php echo $itemFile->getWebPath('original'); ?>" class="chocolat-image">
        <?php echo file_image('fullsize', array('original'), $itemFile); ?> 
        <a href="<?php echo metadata($itemFile, 'uri'); ?>"><br/><?php echo __('+ info'); ?></a> 
<?php endforeach; ?>

Thank you for your help!!

1 Like

Hi @julialyra. Our latest release of “The Daily” now provides links to file metadata pages. For images using the lightbox, they now have captions linking to either the file metadata or the original file depending on the “Link to File Metadata” appearance setting.

Thank you so much for your availability and prompt creating of a new version of the theme “The Daily”, wich contemplates the request presented by our project.
Now, We would like to update the version of “The Daily” theme’s with the new version, but before doing that, we would like to know if the updating will consider the changes we have been doing until now in the HTML, PHP and CSS codes. Or, must we introduce all those changes again, one by one.

Thank you again for all your attention,

If you’ve been modifying a theme, updating it won’t take into account the changes you’ve made. You would need to reapply them.