Exemple #1
0
/**
 * Retrieve the set of ElementText records that correspond to a given
 * element set and element. Copied from Metadata View Helper.
 *
 * @param Omeka_Record_AbstractRecord $record
 * @param string $elementSetName
 * @param string $elementName
 * @return array Set of ElementText records.
 */
function rpiGetElementText($record, $elementSetName, $elementName)
{
    $elementTexts = $record->getElementTexts($elementSetName, $elementName);
    // Lock the records so that they can't be accidentally saved back to the
    // database, since we are modifying their values directly at this point.
    // Also clone the record because otherwise it would be passed by
    // reference to all the display filters, which results in munged text.
    foreach ($elementTexts as $key => $textRecord) {
        $elementTexts[$key] = clone $textRecord;
        $textRecord->lock();
    }
    return $elementTexts;
}