Help needed with "all_element_texts"


I would like some help with the "echo all_element_texts". First, I understand that this is the v2.0 replacement way of representing what the previous "show_file_metadata" did.

I would like to be able to somehow manage the way these metadata are presented in the show.php page, for example, I would like these to populate cells of a table and not be presented vertically in the form of a list.

Could you possibly suggest me a proper, more elegant way of doing so instead of the rather clumsy solution I came up with? (check below).

<td width="20%">Title:</td>
<td width="60%"><h3><?php echo metadata('item', array('Dublin Core', 'Title')); ?></h3></td>
<td width="20%"> </td>
<td width="20%">Creator:</td>
<td width="60%"><h3><?php echo metadata('item', array('Dublin Core', 'Creator')); ?></h3></td>
<td width="20%"> </td>
<td width="20%">Subject:</td>
<td width="60%"><h3><?php echo metadata('item', array('Dublin Core', 'Subject')); ?></h3></td>
<td width="20%"> </td>

My goal is to eliminate as much as possible the vertical scroll in browsing items with many metadata.

Check this screenshot to see what I mean to do and my progress so far. As I say above, this is the rather awkward way...

Isn't it beautiful? At the bottom you can see the left-overs of the Omeka code that displays the metadata as a list.

Ok, I understand that probably I should edit the AllElementTexts.php. We'll see.

Actually, I'd say it's fine to go with something like what you have above. Alternatively, creating your own version of AllElementTexts.php as your own, distinct view helper would be a good approach. Editing AllElementTexts.php directly could have unintended consequences for the admin theme


If I create my own version of AllElementTexts.php, where should I place it? How do I make sure it takes over the original?

Are you looking to change the underlying behavior of the helper, or just something about the output?

You can change just the output more easily by instead overriding the partial.

The best would be to have a list of metadata fields that are not to be published on the public website. Than change the functionality of the helper to read that list and just return the elements that are allowed.

This either as a plugin, or as an additional file in the theme folder somewhere.

I don't really know how to override the partial from a theme or plugin though.

If you're just looking to alter the all_element_texts output in this way, there's a filter that can do that.

The filter display_elements lets you remove elements from the list of elements that will be displayed by all_element_texts.

I noticed that function and it is pretty nice. Although now I am telling all_element_texts() to not display a bunch of metadatafields in a plugin, while I am showing again in the theme's show.php. That seems a bit messy.

I guess there are always all sorts of solutions but it seems best to me to stick as much as possible to what you envision.

I will try to find a way so that I can use the show.php only as a template (by adding some extra fire_plugin_hook() sites) and do all the work on the data from my collection's dedicated plugin.

Why are you having to use the theme to show the elements once you've removed them from the all_element_texts output?

Maybe I'm not understanding what you're doing correctly, but it sounded like you were just trying to remove some elements from the display for certain users or roles. You should be able to do that all in just the filter.

You're partially right. I do want to hide certain information from people that are not logged in. But I also want to show certain metadata on different locations on the page. Creator/Contributor/Collector in a div to the right. Title, Identifier, Text and Description in the div to the left. Some more fields in another div perhaps. And for the future, when people add more metadata fields I want to be able to show them as well.

Also the words "Dublin Core" and "Item Type Metadata" are not of any value to our users.
I checked the forums and found this:
. But this seems no longer valid for 2.0.

Please see this string that relates to where to make changes in 2.0.

Excellent! I didn't find those files yet. Now it works like a charm. Thanks for that.