Get Item Type Metadata

Howdy!

I’m trying to get fields from an item’s Item Type rather than ‘Dublin Core’ in my theme.

So while this works great:

echo metadata($featuredItem, array('Dublin Core', 'Subject'))

Neither of these do:

echo metadata($featuredItem, array('Costume Image', 'Subject'))
echo metadata($featuredItem, array('Item Type', 'Subject'))

resulting in this error:

Omeka_Record_Exception: There is no element "Item Type", "Event"! in V:\dev\icggallery\omeka\Apache24\htdocs\application\models\Mixin\ElementText.php:292

In the first failed version ‘Costume Type’ is the Item Type which includes a field ‘Event’.

I’ve tried searching for example of retrieving an item’s metadata (I’d prefer to get an array of all of the fields at once but that doesn’t appear to be an option requiring multiple roundtrips to the database) but all of them only access ‘Dublin Core’ so I’m looking for some guidance.

Given an item you can ->getFile(0) and ->getCollection() but there is no ->getMetadata() is there a way to get all of an ite’s fields in one gulp?

If the first option isn’t possible how do I get to the non-‘Dublin Core’ metadata?

Thanks!

The “set” you need to pass to get item type metadata is called 'Item Type Metadata'.

Calls to metadata, and in general when dealing with the element texts, already get all the texts in a single database query.

1 Like