Changing field labels (record-metadata.php)

Attempting to edit field names of record-metadata.php, but despite using the following format:

} elseif ($setName == ‘Dublin Core’ && $elementName == ‘Medium’) {
$label = ‘Summary’;

Omeka is not picking up. I wondering if it has anything to do with the fact that did not install this dev Omeka in root and since we did not the following directives needed to be relaxed on the server:

php_flag register_globals off
php_flag magic_quotes_gpc off

I realized that I need to put the record-metadata.php file in:
/omeka/themes/default/common/

rather than my theme directory.

Second question:
How do I change field names on backend item editor?

Thank you!

I tried to edit the:
/omeka/application/migrations/20121218000000_editElementDescriptions.php
file
by changing the label.

For example:
Changing:
$dcCoverage = “The spatial or temporal topic of the resource, the spatial applicability of the resource, or the jurisdiction under which the resource is relevant”;
$sql = “UPDATE {$this->db->Element} SET description = ? WHERE name = ?”;
$this->db->query($sql, array($dcCoverage, ‘Coverage’));
to:
$dcCoverage = “The spatial or temporal topic of the resource, the spatial applicability of the resource, or the jurisdiction under which the resource is relevant”;
$sql = “UPDATE {$this->db->Element} SET description = ? WHERE name = ?”;
$this->db->query($sql, array($dcCoverage, ‘Reviews’));

but it did not change the labels on the edit screen.

Any ideas?

You don’t want to edit those migration files. They only get used when you’re upgrading from an older Omeka version, so any changes you make there won’t do anything.

Editing the labels for the form just isn’t as easy as it is to edit them for display. The label is computed on line 112 of application/views/helpers/ElementForm.php. You could edit that function and have it check against the original label ($this->_element['name']) and change what it returns.

The other option would be to use the ElementForm filter to change the label. You’d have to write a small plugin to do this, but it has the benefit of not being a change to the core you have to worry about preserving when you upgrade.

So, if in record-metadata.php, I have a line that reads:

elseif ($setName == ‘Dublin Core’ && $elementName == ‘Coverage’) {
$label = ‘Reviews’;

In ElementForm.php line 112:
return html_escape($this->_element[‘name’]);
change to:
return html_escape($label]);

?

if($setName=='Dublin Core' && $elementName=='Medium')
{
   $elementName="Summary";
}

I’m not sure where you got $label from? The above code in /omeka/themes/[yourtheme]/common/record-metadata.php will make it show

Summary
This is my summary

instead of

Medium
This is my summary

Make sure you put it before

<label><?php echo html_escape(__($elementName)); ?></label>

Sorry, confused.

Do you mean:
In 'ElementForm.php’
Change:
return html_escape($this->_element[‘name’]);
To:

<?php echo html_escape(__($elementName)); ?>