Display Item Type element: Description

So on the show.php file I can add

<?php echo all_element_texts('item', array('show_element_sets' =>'Item Type Metadata')); ?>

And this displays the item type element title and the content. Is there a way to display the element description?

The view file common/record-metadata.php controls what’s printed when you call all_element_texts. You can edit that file to change what’s included in that output.

Most themes do not include the common/record-metadata.php file, so first you’d need to copy it from the core at application/views/scripts/common/record-metadata.php into your theme at common/record-metadata.php

Then in that copy of the file you could change the h3 element from showing the title to showing the description, or just add it.

<?php echo html_escape($elementInfo['element']->description); ?>

If you only want this to happen for just that specific call that only shows the item type metadata, you can also pass the option partial to the array of options to all_element_texts. So you could instead put your copy of the record-metadata.php file at common/record-metadata-custom.php in your theme, and pass 'partial' => 'common/record-metadata-custom.php' to your all_element_texts call, and the altered display will only happen for that specific call.

2 Likes

This topic was automatically closed 250 days after the last reply. New replies are no longer allowed.