"There is no element..." error navigating to collections/show/1


#1

Hi,
I experienced the following Omeka error, trying to show a collection on the public site (/collections/show/1):

exception 'Omeka_Record_Exception' with message 'There is no element "Item Type Metadata", "Text"!' in /galeneo/application/models/Mixin/ElementText.php:293
Stack trace:
#0 /galeneo/application/models/Mixin/ElementText.php(214): Mixin_ElementText->getElement('Item Type Metad...', 'Text')
#1 [internal function]: Mixin_ElementText->getElementTexts('Item Type Metad...', 'Text')
#2 /galeneo/application/libraries/Omeka/Record/AbstractRecord.php(251): call_user_func_array(Array, Array)
#3 /galeneo/application/libraries/Omeka/Record/AbstractRecord.php(210): Omeka_Record_AbstractRecord->delegateToMixins('getElementTexts', Array)
#4 /galeneo/application/views/helpers/Metadata.php(173): Omeka_Record_AbstractRecord->__call('getElementTexts', Array)
#5 /galeneo/application/views/helpers/Metadata.php(173): Item->getElementTexts('Item Type Metad...', 'Text')
#6 /galeneo/application/views/helpers/Metadata.php(139): Omeka_View_Helper_Metadata->_getElementText(Object(Item), 'Item Type Metad...', 'Text')
#7 /galeneo/application/views/helpers/Metadata.php(70): Omeka_View_Helper_Metadata->_getText(Object(Item), Array)
#8 [internal function]: Omeka_View_Helper_Metadata->metadata('item', Array, Array)
#9 /galeneo/application/libraries/Zend/View/Abstract.php(350): call_user_func_array(Array, Array)
#10 /galeneo/application/libraries/globals.php(2033): Zend_View_Abstract->__call('metadata', Array)
#11 /galeneo/application/libraries/globals.php(2033): Omeka_View->metadata('item', Array, Array)
#12 /galeneo/application/views/scripts/collections/show.php(25): metadata('item', Array, Array)
#13 /galeneo/application/libraries/Omeka/View.php(117): include('/galeneo/applic...')
#14 /galeneo/application/libraries/Zend/View/Abstract.php(888): Omeka_View->_run('/galeneo/applic...')
#15 /galeneo/application/libraries/Zend/Controller/Action/Helper/ViewRenderer.php(912): Zend_View_Abstract->render('collections/sho...')
#16 /galeneo/application/libraries/Zend/Controller/Action/Helper/ViewRenderer.php(933): Zend_Controller_Action_Helper_ViewRenderer->renderScript('collections/sho...', NULL)
#17 /galeneo/application/libraries/Zend/Controller/Action/Helper/ViewRenderer.php(972): Zend_Controller_Action_Helper_ViewRenderer->render()
#18 /galeneo/application/libraries/Zend/Controller/Action/HelperBroker.php(277): Zend_Controller_Action_Helper_ViewRenderer->postDispatch()
#19 /galeneo/application/libraries/Zend/Controller/Action.php(527): Zend_Controller_Action_HelperBroker->notifyPostDispatch()
#20 /galeneo/application/libraries/Zend/Controller/Dispatcher/Standard.php(308): Zend_Controller_Action->dispatch('showAction')
#21 /galeneo/application/libraries/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#22 /galeneo/application/libraries/Zend/Application/Bootstrap/Bootstrap.php(105): Zend_Controller_Front->dispatch()
#23 /galeneo/application/libraries/Zend/Application.php(384): Zend_Application_Bootstrap_Bootstrap->run()
#24 /galeneo/application/libraries/Omeka/Application.php(79): Zend_Application->run()
#25 /galeneo/index.php(23): Omeka_Application->run()
#26 {main}

I installed a new Omeka 2.4.1 instance with CSVImport 2.0.4 plugin and imported over 400 records from csv file. The import was successfully completed and I can browse all the items on the admin page without any problems. The /admin/collections/show/1 link works ok for the admin page. The above error happens for the public interface only.
How to diagnose and solve it?


#2

You deleted the “Text” Item Type Metadata element, which the theme is trying to look for to display.

You can re-create an item type metadata element named “Text” or edit the theme to not try to retrieve it.


#3

Yes, you are right. I deleted all the default Item Type Metadata elements and replaced them by my own. However this is not very unusual scenario and many users can do so. I also temporarily use the “standard” Berlin theme but looking at the theme files, there is no collections/show.php file in the theme directory. So the theme uses the defaul Omeka’s file /application/views/scripts/collections/show.php
And the file really includes (starting from line 25):

    <?php if ($text = metadata('item', array('Item Type Metadata', 'Text'), array('snippet'=>250))): ?>


            <div class="item-description">


                <p><?php echo $text; ?></p>


            </div>

Why this field have to be displayed by default? Since this is not obligatory field (like Dublin Core) an Omeka’s user is able to remove it (like any other of the Item Type Metadata fields).


#4

I’m hesitant to remove the display of Text because current sites could be relying on it.

Maybe another option is to allow metadata to just fail silently on not finding an Item Type Metadata field. Or even better, have something passed in the options to suppress the exception on not finding the element, which we can then use in these default places that look for Text.


#5

If this is really needed for backward compatibility, the most reasonable solution for me would be a “silent fail” mechanism for all the Itemtype metadata fields.


#6

On the other hand it seems we’ve slowly eliminated basically everywhere else we do this so you may indeed be right that pulling that out of the collections show is the most straightforward solution.


#7

I’m getting a similar error, but mine is There is no element “Item Type Metadata”, "Player. So I’m assuming I have to ad Player somewhere, but do I add it under Manage Elements, or is it an Item Type, or an element under one of the existing Item Types?

Thanks