size}px;height:{$settings->size}px;background-color:red;' >
{$file['display-name']}
";
}
/**
* hook_filebrowser_handler_settings implementation
* @param $settings previously stored settings (see this as a kind of $form_data)
* @return a Drupal form element
*/
function filebrowser_STARTER_filebrowser_handler_settings($settings) {
$form['size'] = array(
'#type' => 'textfield',
'#title' => t('Thumbnails size'),
'#default_value' => $settings->size ? $settings->size : 128,
'#description' => t("Thumbnails size.")
);
return $form;
}
/**
* hook_filebrowser_handler_info()
* @return An array describing the handler.
*/
function filebrowser_STARTER_filebrowser_handler_info() {
return array(
'description' => 'filebrowser STARTER handler'
);
}
/**
* hook_filebrowser_metadata_info implementation.
* @return an array of metatada information.
*/
function filebrowser_STARTER_filebrowser_metadata_info() {
return array(
'STARTER_genre' => array(
'title'=>'genre' ,
'writable'=>FALSE,
'sortable'=>TRUE,
'type'=>'string'));
}
/**
* hook_filebrowser_metadata_get implementation.
* @file the filebrowser file object to extract metadata from
* @return an array of metatada
*/
function filebrowser_STARTER_filebrowser_metadata_get($file) {
/**
* Initialize GetID3 module
**/
getid3_load($display_warning=TRUE);
$getid3 = new getID3;
$getid3->encoding = 'UTF-8';
header('Content-Type: text/html; charset=UTF-8');
$FileTag = $getID3->analyze($file);
getid3_lib::CopyTagsToComments($FileTag);
return array(
'STARTER_genre' => $FileTag['comments_html']['genre']);
};
/**
* hook_filebrowser_metadata_get implementation.
* @file the filebrowser file object to extract metadata from
* @return an array of metatada
*/
function filebrowser_STARTER_filebrowser_metadata_set($file, $metadata) {
if (isset($metadata['STARTER_foo'])) {
drupal_set_message('It seems that you want to change "foo" to ' . $metadata['STARTER_foo'] . ' for ' . $file['display-name']);
}
}
/**
* hook_filebrowser_presentation implementation.
* @return a list of presentation composed by a unique key (of the array), a title and a theme
* name that will be used like this :
* theme(PRESENTATION_THEME, $filebrowser_node);
* So this can be a theme function or a template. $node->file_listing give you access to
* file objects.
*/
function filebrowser_STARTER_filebrowser_presentation() {
return array(
'foo-view' => array(
'title' => t('STARTER view'),
'theme' => 'filebrowser_STARTER_view'
)
);
}
/**
* hook_theme implementation.
*/
function filebrowser_STARTER_theme() {
return array(
'filebrowser_STARTER_view' => array(
'arguments' => array(
'node' => NULL
),
'template' => 'filebrowser_STARTER_view'
)
);
}
/**
* hook_filebrowser_download_manager_info implementation.
* @return an array of avalaible downlod managers (key/human description)
*/
function filebrowser_STARTER_filebrowser_download_manager_info() {
return array(
'foo' => array(
'title' => t('Foo download manager')
)
);
}
/**
* hook_filebrowser_download_manager_process implementation.
* @param delta the key of the download manager.
* @param file the file object to download
* @param filename exposed file name
* @return nothing, but don't forget the exit() at the end of processing except if you want
* to throw an access denied error.
*/
function filebrowser_STARTER_filebrowser_download_manager_process($delta = NULL, $file = NULL, $filename = NULL) {
switch ($delta) {
case 'foo' :
print "I'm a foo downloader and I don't want to work today (I'm also french..;-).
";
print "file: $file
";
print "target: $filename
";
exit();
}
}