Commit 6b4eb5e4 authored by aaronwinborn's avatar aaronwinborn

* Create media_metadata_add() (aaron).

parent 55a3ab29
......@@ -2,6 +2,10 @@
/** Changelog for media_metadatad.module **/
August 2009
-----------
* Create media_metadata_add() (aaron).
July 2009
-------------
* media_metadata.install brought up to D7 spec (jmstacey).
......
......@@ -63,6 +63,6 @@ function media_metadata_schema() {
'meta_key' => array('fid', 'name'),
),
);
return $schema;
}
\ No newline at end of file
}
......@@ -60,12 +60,12 @@ function media_metadata_keys($mimetype = '*', $exclusive = FALSE, $reset = FALSE
*/
function media_metadata_form($form_state, $mimetype = '*') {
$form = module_invoke_all('media_metadata_form', $form_state, $mimetype);
$form['mimetype'] = array(
'#type' => 'value',
'#value' => $mimetype,
);
$form['#submit'] = array('media_metadata_form_submit');
}
......@@ -83,7 +83,7 @@ function media_metadata_form_submit($form, &$form_state) {
$mimetype = $form_state['values']['mimetype'];
$keys = media_metadata_keys($mimetype);
$values = array();
foreach ($keys as $key) {
$values[$key] = $form_state['values'][$key];
}
......@@ -177,7 +177,14 @@ function media_metadata_by_uri($uri, $unhandled = FALSE) {
* Returns the new mid of the key value pair on success, or FALSE on failure.
*/
function media_metadata_add($fid, $name, $data) {
// TODO: Implement
// Create the db record containing the metadata to be saved.
$record = array(
'fid' => $fid,
'name' => $name,
'data' => $data,
);
drupal_write_record('media_metadata', $record);
return $record->mid;
}
/**
......
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