Display a specific property value

Hi, is there a function similar to the metadata() function in omeka classic? I located the displayDescription function in the AbstractResourceEntityRepresentation.php api file, and used it to create the function below:

public function displayPropertyValue($propertyvalue)
    {
        return (string) $this->value($propertyvalue, [
            'default' => $default,
        ]);
    }

Is there something that already does this? I’d rather not get into the business of modifying the API if I can help it. If not, would this be a safe feature to add for future versions? For example, if you code

echo $item -> displayPropertyValue('dcterms:subject');

The value of the Subject property would be echoed in that spot.

thanks!

Yep, the value method:

echo $item->value('dcterms:subject');
1 Like

What if Subject has multiple values?
What’s the equivalent to Classic’s

array('all' => true)

I’m editing to say all values can be retrieved just like in Classic. For example…

echo $item->value('dcterms:subject', array('all' => true));

I should have tried it before posting!!! But hopefully this will be useful to someone else.

2 Likes