Get a list of item type elements

I’m using the following to create an array of DC element names:

$itemMetadata = array();		
$dc= get_record('ElementSet',array('name'=>'Dublin Core'));
$dcElements=[];
foreach ($dc->getElements() as $element){
	$dcElements[]=$element->name;
}

How can I create a similar array of all Item Type Metadata elements?

Thanks!

I think that if you put Item Type Metadata in place of Dublin Core, it should give what you want.

Also, I’m not sure that $dcElements=[]; notation will always work with the minimum PHP requirements for Omeka 2.4. Might be safer to use the older array() notation.

1 Like

Perfect, thanks!

function getElementsForSet($setName){
	$elementSet= get_record('ElementSet',array('name'=>"$setName"));
	$elements=array();
	foreach ($elementSet->getElements() as $element){
		$elements[]=$element->name;
	}	
	return $elements;	
}