public function KalturaHelpers::getEntryMetadata in Kaltura 7.3
Retrieves custom metadata for entry.
Parameters
string $entry_id: Kaltura media entry ID.
Return value
array Each array's element corresponds to metadata from one profile: key is the profile ID and value is an array with the following elements:
- fields: Array with metadata fields, where each key is the field's system name and each value is an indexed array of field's values.
- metadata: KalturaMetadata object as returned from the service.
File
- kaltura_client/
kaltura_helpers.php, line 329
Class
- KalturaHelpers
- Class KalturaHelpers.
Code
public function getEntryMetadata($entry_id) {
$data = array();
try {
$client = $this
->getKalturaClient(TRUE);
$plugin = KalturaMetadataClientPlugin::get($client);
$filter = new KalturaMetadataFilter();
$filter->metadataObjectTypeEqual = KalturaMetadataObjectType::ENTRY;
$filter->objectIdEqual = $entry_id;
$response = $plugin->metadata
->listAction($filter);
foreach ($response->objects as $object) {
$fields = array();
$xml = simplexml_load_string($object->xml);
foreach ($xml
->children() as $xml_node) {
$fields[$xml_node
->getName()][] = (string) $xml_node;
}
$data[$object->metadataProfileId] = array(
'fields' => $fields,
'metadata' => $object,
);
}
} catch (Exception $e) {
watchdog_exception('kaltura', $e);
}
return $data;
}