Commit 9ff308da authored by aaronwinborn's avatar aaronwinborn

* Filter media_metadata_by_fid so that only keys handled by a registered module

  are returned (aaron).
parent 832b98b3
......@@ -4,6 +4,8 @@
August 2009
-----------
* Filter media_metadata_by_fid so that only keys handled by a registered module
are returned (aaron).
* Begin implementation of media_metadata_by_fid() (aaron).
* Remove return value in media_metadata_delete documentation (aaron).
* Implement media_metadata_delete() (aaron).
......
......@@ -118,9 +118,14 @@ function media_metadata_by_fid($fid, $unhandled = FALSE) {
$result = db_query("SELECT name, data FROM {media_metadata} WHERE fid = :fid", array(
':fid' => $fid,
));
// @TODO: Get only the keys handled for the file's MIMEtype.
$keys = media_metadata_keys();
foreach ($result as $record) {
// @TODO: Honor $unhandled. This currently returns the raw result from the query.
$metadata[$record->name] = $record->data;
// Filter so that only keys handled by a registered module are returned,
// unless $unhandled is TRUE.
if ($unhandled || in_array($keys, $record->name)) {
$metadata[$record->name] = $record->data;
}
}
return $metadata;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment