New module 'FileField'

This commit is contained in:
Manuel Cillero 2017-07-26 19:47:34 +02:00
parent 673511a713
commit f8571672d1
44 changed files with 5831 additions and 0 deletions

View file

@ -0,0 +1,14 @@
name = FileField Meta
description = Add metadata gathering and storage to FileField.
dependencies[] = filefield
dependencies[] = getid3
package = CCK
core = 6.x
php = 5.0
; Information added by Drupal.org packaging script on 2016-02-24
version = "6.x-3.14"
core = "6.x"
project = "filefield"
datestamp = "1456327142"

View file

@ -0,0 +1,173 @@
<?php
/**
* @file
* FileField Meta: Add Video Support to File Field.
*/
/**
* Implementation of hook_install().
*/
function filefield_meta_install() {
drupal_install_schema('filefield_meta');
}
function filefield_meta_uninstall() {
drupal_uninstall_schema('filefield_meta');
}
/**
* Implementation of hook_schema().
*/
function filefield_meta_schema() {
$schema = array();
// The primary field/index.
$schema['filefield_meta'] = array(
'description' => 'The table for meta data about filefield files.',
'fields' => array(
'fid' => array(
'description' => 'The file id.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'width' => array(
'description' => 'Width of a video or image file in pixels.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => FALSE,
),
'height' => array(
'description' => 'Height of a video or image file in pixels.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => FALSE,
),
'duration' => array(
'description' => 'The duration of audio or video files, in seconds.',
'type' => 'float',
'size' => 'normal',
'not null' => FALSE,
),
'audio_format' => array(
'description' => 'The audio format.',
'type' => 'varchar',
'length' => 10,
'not null' => TRUE,
'default' => '',
),
'audio_sample_rate' => array(
'description' => 'The sample rate of the audio.',
'type' => 'int',
'size' => 'medium',
'not null' => TRUE,
'default' => 0,
),
'audio_channel_mode' => array(
'description' => 'The number of channels in the audio, by name (stereo or mono).',
'type' => 'varchar',
'length' => 10,
'not null' => TRUE,
'default' => '',
),
'audio_bitrate' => array(
'description' => 'The audio bitrate.',
'type' => 'float',
'size' => 'medium',
'not null' => TRUE,
'default' => 0,
),
'audio_bitrate_mode' => array(
'description' => 'The kind of audio bitrate, such as VBR. Usually empty.',
'type' => 'varchar',
'length' => 4,
'not null' => TRUE,
'default' => '',
),
'tags' => array(
'description' => 'ID3 tags such as artist, album, and genre.',
'type' => 'text',
'serialize' => TRUE,
),
),
'primary key' => array('fid'),
);
return $schema;
}
function filefield_meta_update_1() {
$ret = array();
db_add_field($ret, 'filefield_meta', 'audio_format', array(
'description' => 'The audio format.',
'type' => 'varchar',
'length' => 10,
'not null' => TRUE,
'default' => '',
));
db_add_field($ret, 'filefield_meta', 'audio_sample_rate', array(
'description' => 'The sample rate of the audio.',
'type' => 'int',
'size' => 'medium',
'not null' => TRUE,
'default' => 0,
));
db_add_field($ret, 'filefield_meta', 'audio_channel_mode', array(
'description' => 'The number of channels in the audio, by name.',
'type' => 'varchar',
'length' => 10,
'not null' => TRUE,
'default' => '',
));
db_add_field($ret, 'filefield_meta', 'audio_bitrate', array(
'description' => 'The audio bitrate.',
'type' => 'float',
'size' => 'medium',
'not null' => TRUE,
'default' => 0,
));
db_add_field($ret, 'filefield_meta', 'audio_bitrate_mode', array(
'description' => 'The kind of audio bitrate.',
'type' => 'varchar',
'length' => 4,
'not null' => TRUE,
'default' => '',
));
return $ret;
}
/**
* Add the tags column.
*/
function filefield_meta_update_6100(&$context) {
$ret = array();
// Set up our update and add the tags column.
if (!isset($context['sandbox']['progress'])) {
$context['sandbox']['progress'] = 0;
$context['sandbox']['total'] = db_result(db_query("SELECT COUNT(*) FROM {files} f INNER JOIN {filefield_meta} fm ON f.fid = fm.fid WHERE fm.audio_format <> ''"));
$context['sandbox']['current_fid'] = 0;
if (!db_column_exists('filefield_meta', 'tags')) {
db_add_field($ret, 'filefield_meta', 'tags', array('type' => 'text'));
}
// We are done if there are none to update.
if ($context['sandbox']['total'] == 0) {
return $ret;
}
}
// Select and process 200 files at a time.
$limit = 200;
$result = db_query_range("SELECT f.* FROM {files} f INNER JOIN {filefield_meta} fm ON f.fid = fm.fid WHERE f.fid > %d AND fm.audio_format <> '' ORDER BY f.fid ASC", $context['sandbox']['current_fid'], 0, $limit);
// Loop through each file and read in its ID3 tags if applicable.
while ($file = db_fetch_object($result)) {
filefield_meta_file_update($file);
$context['sandbox']['current_fid'] = $file->fid;
$context['sandbox']['progress']++;
}
// Update our progress indicator.
$ret['#finished'] = $context['sandbox']['progress'] / $context['sandbox']['total'];
return $ret;
}

View file

@ -0,0 +1,211 @@
<?php
/**
* @file
* FileField Meta: Add Video Support to File Field.
*/
/**
* Implementation of hook_init().
*/
function filefield_meta_init() {
// Conditional module support.
if (module_exists('token')) {
module_load_include('inc', 'filefield_meta', 'filefield_meta.token');
}
}
/**
* Implementation of hook_theme().
*/
function filefield_meta_theme() {
return array(
'filefield_meta_duration' => array(
'arguments' => array('duration' => NULL),
),
'filefield_meta_samplerate' => array(
'arguments' => array('samplerate' => NULL),
),
'filefield_meta_bitrate' => array(
'arguments' => array('bitrate' => NULL),
),
);
}
/**
* Implementation of hook_cron().
*/
function filefield_meta_cron() {
$result = db_query('SELECT fm.fid FROM {filefield_meta} fm LEFT JOIN {files} f ON fm.fid=f.fid WHERE f.fid IS NULL');
while ($file = db_fetch_object($result)) {
db_query('DELETE FROM {filefield_meta} WHERE fid = %d', $file->fid);
}
}
/**
* Implementation of hook_views_api().
*/
function filefield_meta_views_api() {
return array(
'api' => 2.0,
'path' => drupal_get_path('module', 'filefield_meta') . '/includes',
);
}
/**
* Implementation of FileField's hook_file_load().
*/
function filefield_meta_file_load(&$file) {
$result = db_query("SELECT * FROM {filefield_meta} WHERE fid = %d", $file->fid);
$data = db_fetch_array($result);
// Essentially this is a lazy-loader. If no record exists, read in the file.
if ($data) {
$data['tags'] = isset($data['tags']) ? unserialize($data['tags']) : array();
$file->data = isset($file->data) ? array_merge($file->data, $data) : $data;
}
else {
filefield_meta_file_insert($file);
}
}
/**
* Implementation of FileField's hook_file_insert().
*/
function filefield_meta_file_insert(&$file) {
if (!empty($file->fid)) {
filefield_meta($file);
$record = array_merge($file->data, array('fid' => $file->fid));
drupal_write_record('filefield_meta', $record);
}
}
/**
* Implementation of FileField's hook_file_update().
*/
function filefield_meta_file_update(&$file) {
if (!empty($file->fid)) {
filefield_meta_file_delete($file);
filefield_meta_file_insert($file);
}
}
/**
* Implementation of FileField's hook_file_delete().
*/
function filefield_meta_file_delete($file) {
db_query('DELETE FROM {filefield_meta} WHERE fid = %d', $file->fid);
}
/**
* Adds the width, height and duration to the file's data property.
*/
function filefield_meta(&$file) {
$file->data = !empty($file->data) ? $file->data : array();
// Skip any attempts at adding information if the file is not actually
// located on this server.
if (!file_exists($file->filepath)) {
return;
}
$info = getid3_analyze($file->filepath);
$file->data['width'] = $file->data['height'] = $file->data['duration'] = 0;
if (isset($info['video']['resolution_x'])) {
$file->data['width'] = $info['video']['resolution_x'];
$file->data['height'] = $info['video']['resolution_y'];
}
elseif (isset($info['video']['streams'])) {
foreach ($info['video']['streams'] as $stream) {
$file->data['width'] = max($file->data['width'], $stream['resolution_x']);
$file->data['height'] = max($file->data['height'], $stream['resolution_y']);
}
}
if (isset($info['playtime_seconds'])) {
$file->data['duration'] = $info['playtime_seconds'];
}
// Initialize fields.
$file->data['audio_format'] = $file->data['audio_channel_mode'] = $file->data['audio_bitrate_mode'] = '';
$file->data['audio_sample_rate'] = $file->data['audio_bitrate'] = 0;
if (isset($info['audio'])) {
$file->data['audio_format'] = $info['audio']['dataformat']; //e.g. mp3
$file->data['audio_sample_rate'] = $info['audio']['sample_rate']; //e.g. 44100
$file->data['audio_channel_mode'] = $info['audio']['channelmode']; // e.g. mono
$file->data['audio_bitrate'] = isset($info['audio']['bitrate']) ? $info['audio']['bitrate'] : NULL; //e.g. 64000
$file->data['audio_bitrate_mode'] = isset($info['audio']['bitrate_mode']) ? $info['audio']['bitrate_mode'] : NULL; //e.g. cbr
}
// Add in arbitrary ID3 tags.
if (isset($info['tags_html'])) {
// We use tags_html instead of tags because it is the most reliable data
// source for pulling in non-UTF-8 characters according to getID3 docs.
foreach ($info['tags_html'] as $type => $values) {
// Typically $type may be IDv2 (for MP3s) or quicktime (for AAC).
foreach ($values as $key => $value) {
$value = isset($value[0]) ? (string) $value[0] : (string) $value;
if (!empty($value) && $key != 'coverart' && $key != 'music_cd_identifier') {
$file->data['tags'][$key] = html_entity_decode($value, ENT_QUOTES, 'UTF-8');
}
}
}
}
}
/**
* Utility function that simply returns the current list of all known ID3 tags.
*
* If new or different ID3 tags are desired, these may be overridden by adding
* the following to your site's settings.php file.
*
* @code
* $conf['filefield_meta_tags'] = array(
* 'title' => t('Title'),
* 'artist' => t('Artist'),
* 'composer' => t('Composer'),
* // etc...
* );
* @endcode
*/
function filefield_meta_tags() {
$defaults = array(
'title' => t('Title'),
'artist' => t('Artist'),
'album' => t('Album'),
'year' => t('Year'),
'genre' => t('Genre'),
);
return variable_get('filefield_meta_tags', $defaults);
}
/**
* Convert the float duration into a pretty string.
*
* @param $duration
*/
function theme_filefield_meta_duration($duration) {
$seconds = round((($duration / 60) - floor($duration / 60)) * 60);
$minutes = floor($duration / 60);
if ($seconds >= 60) {
$seconds -= 60;
$minutes++;
}
return intval($minutes) . ':' . str_pad($seconds, 2, 0, STR_PAD_LEFT);
}
/**
* Formats audio sample rate.
*/
function theme_filefield_meta_samplerate($samplerate) {
return t('@sampleratekHz', array('@samplerate' => (int) ($samplerate/1000)));
}
/**
* Formats audio bit rate.
*/
function theme_filefield_meta_bitrate($bitrate) {
return t('@bitrateKbps', array('@bitrate' => (int) ($bitrate/1000)));
}

View file

@ -0,0 +1,59 @@
<?php
/**
* @file
* Token integration for FileField Meta.
*/
/**
* Implementation of hook_token_list().
*
* Provide a user readable list of FileField Meta tokens.
*/
function filefield_meta_token_list($type = 'all') {
if ($type == 'field' || $type == 'all') {
$tokens['file']['filefield-width'] = t('File Video width');
$tokens['file']['filefield-height'] = t('File Video height');
$tokens['file']['filefield-duration'] = t('File Duration');
$tokens['file']['filefield-audio-format'] = t('File Audio Format path');
$tokens['file']['filefield-audio-sample-rate'] = t('File Audio sample rate');
$tokens['file']['filefield-audio-channel-mode'] = t('File Audio channel mode (stereo, mono)');
$tokens['file']['filefield-audio-bitrate'] = t('File Audio bitrate');
$tokens['file']['filefield-audio-bitrate-mode'] = t('File Audio bitrate mode (cbr, vbr, abr...)');
// ID3 tags.
foreach (filefield_meta_tags() as $tag => $label) {
$tokens['file']['filefield-tag-' . $tag] = t('File ID3 @tag tag', array('@tag' => $label));
}
return $tokens;
}
}
/**
* Implementation of hook_token_values().
*
* Provide the token values for a given file item.
*/
function filefield_meta_token_values($type, $object = NULL) {
$tokens = array();
if ($type == 'field' && isset($object[0]['fid'])) {
$item = $object[0];
$tokens['filefield-width'] = $item['data']['width'] ;
$tokens['filefield-height'] = $item['data']['height'] ;
$tokens['filefield-duration'] = $item['data']['duration'] ;
$tokens['filefield-audio-format'] = isset($item['data']['audio_format']) ? check_plain($item['data']['audio_format']) : '';
$tokens['filefield-audio-sample-rate'] = isset($item['data']['sample_rate']) ? check_plain($item['data']['sample_rate']) : '';
$tokens['filefield-audio-channel-mode'] = isset($item['data']['audio_channel_mode']) ? check_plain($item['data']['audio_channel_mode']) : '';
$tokens['filefield-audio-bitrate'] = isset($item['data']['audio_bitrate']) ? check_plain($item['data']['audio_bitrate']) : '';
$tokens['filefield-audio-bitrate-mode'] = isset($item['data']['audio_bitrate_mode']) ? check_plain($item['data']['audio_bitrate_mode']) : '';
// ID3 tags.
foreach (filefield_meta_tags() as $tag => $label) {
$tokens['filefield-tag-title'] = isset($item['data']['tags'][$tag]) ? check_plain($item['data']['tags'][$tag]) : '';
}
}
return $tokens;
}

View file

@ -0,0 +1,205 @@
<?php
/**
* @file
* Provide views data for filefield_meta.module.
*/
/**
* @defgroup views_filefield_meta_module filefield_meta.module handlers
*
* Includes the tables 'node', 'node_revisions' and 'history'.
* @{
*/
/**
* Implementation of hook_views_data()
*/
function filefield_meta_views_data() {
// Define the base group of this table. Fields that don't
// have a group defined will go into this field by default.
$data['filefield_meta']['table']['group'] = t('File');
// For other base tables, explain how we join
$data['filefield_meta']['table']['join'] = array(
// this explains how the 'filefield_meta' table (named in the line above)
// links toward the files table.
'files' => array(
'left_table' => 'files', // Because this is a direct link it could be left out.
'left_field' => 'fid',
'field' => 'fid',
),
);
// ----------------------------------------------------------------
// filefield_meta table -- fields
// width
$data['filefield_meta']['width'] = array(
'title' => t('Video width'),
'help' => t('Width of a video or image file in pixels.'),
'field' => array(
'handler' => 'views_handler_field_numeric',
'click sortable' => TRUE,
),
'sort' => array(
'handler' => 'views_handler_sort',
),
'filter' => array(
'handler' => 'views_handler_filter_numeric',
),
);
// height
$data['filefield_meta']['height'] = array(
'title' => t('Video height'),
'help' => t('Height of a video or image file in pixels.'),
'field' => array(
'handler' => 'views_handler_field_numeric',
'click sortable' => TRUE,
),
'sort' => array(
'handler' => 'views_handler_sort',
),
'filter' => array(
'handler' => 'views_handler_filter_numeric',
),
);
// duration
$data['filefield_meta']['duration'] = array(
'title' => t('Duration'),
'help' => t('The duration of audio or video files, in seconds.'),
'field' => array(
'handler' => 'filefield_meta_handler_field_duration',
'click sortable' => TRUE,
),
'sort' => array(
'handler' => 'views_handler_sort',
),
'filter' => array(
'handler' => 'views_handler_filter_numeric',
),
);
// audio_format
$data['filefield_meta']['audio_format'] = array(
'title' => t('Audio format'),
'help' => t('The audio format.'),
'field' => array(
'handler' => 'views_handler_field',
'click sortable' => TRUE,
),
'sort' => array(
'handler' => 'views_handler_sort',
),
'filter' => array(
'handler' => 'views_handler_filter_string',
),
);
// audio_sample_rate
$data['filefield_meta']['audio_sample_rate'] = array(
'title' => t('Audio sample rate'),
'help' => t('The sample rate of the audio.'),
'field' => array(
'handler' => 'filefield_meta_handler_field_samplerate',
'click sortable' => TRUE,
),
'sort' => array(
'handler' => 'views_handler_sort',
),
'filter' => array(
'handler' => 'views_handler_filter_numeric',
),
);
// audio_channel_mode
$data['filefield_meta']['audio_channel_mode'] = array(
'title' => t('Audio channel mode'),
'help' => t('The number of channels in the audio, by name (stereo or mono).'),
'field' => array(
'handler' => 'views_handler_field',
'click sortable' => TRUE,
),
'sort' => array(
'handler' => 'views_handler_sort',
),
'filter' => array(
'handler' => 'views_handler_filter_string',
),
);
// audio_bitrate
$data['filefield_meta']['audio_bitrate'] = array(
'title' => t('Audio bitrate'),
'help' => t('The audio bitrate.'),
'field' => array(
'handler' => 'filefield_meta_handler_field_bitrate',
'click sortable' => TRUE,
),
'sort' => array(
'handler' => 'views_handler_sort',
),
'filter' => array(
'handler' => 'views_handler_filter_numeric',
),
);
// audio_bitrate_mode
$data['filefield_meta']['audio_bitrate_mode'] = array(
'title' => t('Audio bitrate mode'),
'help' => t('The kind of audio bitrate, such as VBR. Usually empty.'),
'field' => array(
'handler' => 'views_handler_field',
'click sortable' => TRUE,
),
'sort' => array(
'handler' => 'views_handler_sort',
),
'filter' => array(
'handler' => 'views_handler_filter_string',
),
);
// Tags.
$data['filefield_meta']['tags'] = array(
'title' => t('ID3 tags'),
'help' => t('ID3 tags include embedded information such as artist, album, year, genre and other information.'),
'field' => array(
'handler' => 'filefield_meta_handler_field_tags',
'click sortable' => FALSE,
),
);
return $data;
}
/**
* Implementation of hook_views_handlers().
*/
function filefield_meta_views_handlers() {
return array(
'info' => array(
'path' => drupal_get_path('module', 'filefield_meta') . '/includes',
),
'handlers' => array(
// field handlers
'filefield_meta_handler_field_bitrate' => array(
'parent' => 'views_handler_field_numeric',
),
'filefield_meta_handler_field_duration' => array(
'parent' => 'views_handler_field_numeric',
),
'filefield_meta_handler_field_samplerate' => array(
'parent' => 'views_handler_field_numeric',
),
'filefield_meta_handler_field_tags' => array(
'parent' => 'views_handler_field_prerender_list',
),
),
);
}
/**
* @}
*/

View file

@ -0,0 +1,62 @@
<?php
/**
* @file
* A special handler that properly formats bit rate fields as Kbps.
*/
/**
* Render a field as a readable value in hours, minutes, and seconds.
*
* @ingroup views_field_handlers
*/
class filefield_meta_handler_field_bitrate extends views_handler_field_numeric {
function option_definition() {
$options = parent::option_definition();
$options['format'] = array('default' => 'default', 'translatable' => TRUE);
// Remove the separator options since we don't need them.
unset($options['separator']);
return $options;
}
function options_form(&$form, &$form_state) {
parent::options_form($form, $form_state);
// Remove the separator and alter options since we don't need them.
unset($form['separator']);
$form['prefix']['#weight'] = 10;
$form['suffix']['#weight'] = 10;
$form['format'] = array(
'#type' => 'select',
'#title' => t('Format'),
'#default_value' => $this->options['format'],
'#options' => array(
'default' => t('Default (Mbps or Kbps)'),
'raw' => t('Raw numberic value'),
),
);
}
function render($values) {
$value = $values->{$this->field_alias};
// Check to see if hiding should happen before adding prefix and suffix.
if ($this->options['hide_empty'] && empty($value) && ($value !== 0 || $this->options['empty_zero'])) {
return '';
}
switch ($this->options['format']) {
case 'raw':
$output = $value;
break;
default:
$output = theme('filefield_meta_bitrate', $value);
}
return check_plain($this->options['prefix']) . $output . check_plain($this->options['suffix']);
}
}

View file

@ -0,0 +1,74 @@
<?php
/**
* @file
* A special handler that properly formats duration fields as minutes:seconds.
*/
/**
* Render a field as a readable value in hours, minutes, and seconds.
*
* @ingroup views_field_handlers
*/
class filefield_meta_handler_field_duration extends views_handler_field_numeric {
function option_definition() {
$options = parent::option_definition();
$options['format'] = array('default' => 'default', 'translatable' => TRUE);
// Remove the separator options since we don't need them.
unset($options['separator']);
return $options;
}
function options_form(&$form, &$form_state) {
parent::options_form($form, $form_state);
// Remove the separator options since we don't need them.
unset($form['separator']);
$form['prefix']['#weight'] = 10;
$form['suffix']['#weight'] = 10;
$form['format'] = array(
'#type' => 'select',
'#title' => t('Time format'),
'#default_value' => $this->options['format'],
'#options' => array(
'default' => t('Default (usually mm:ss)'),
'hours' => t('Hours: h'),
'minutes' => t('Minutes: mm'),
'seconds' => t('Seconds: ss'),
'total' => t('Total seconds'),
),
);
}
function render($values) {
$value = $values->{$this->field_alias};
switch ($this->options['format']) {
case 'hours':
$output = date('g', (int) $value);
break;
case 'minutes':
$output = date('i', (int) $value);
break;
case 'seconds':
$output = date('s', (int) $value);
break;
case 'total':
$output = check_plain($value);
break;
default:
$output = theme('filefield_meta_duration', $value);
}
// Check to see if hiding should happen before adding prefix and suffix.
if ($this->options['hide_empty'] && empty($value) && ($value !== 0 || $this->options['empty_zero'])) {
return '';
}
return check_plain($this->options['prefix']) . $output . check_plain($this->options['suffix']);
}
}

View file

@ -0,0 +1,62 @@
<?php
/**
* @file
* A special handler that properly formats bit rate fields as kHz.
*/
/**
* Render a field as a readable value in hours, minutes, and seconds.
*
* @ingroup views_field_handlers
*/
class filefield_meta_handler_field_samplerate extends views_handler_field_numeric {
function option_definition() {
$options = parent::option_definition();
$options['format'] = array('default' => 'default', 'translatable' => TRUE);
// Remove the separator options since we don't need them.
unset($options['separator']);
return $options;
}
function options_form(&$form, &$form_state) {
parent::options_form($form, $form_state);
// Remove the separator options since we don't need them.
unset($form['separator']);
$form['prefix']['#weight'] = 10;
$form['suffix']['#weight'] = 10;
$form['format'] = array(
'#type' => 'select',
'#title' => t('Format'),
'#default_value' => $this->options['format'],
'#options' => array(
'default' => t('Default (kHz)'),
'raw' => t('Raw numberic value'),
),
);
}
function render($values) {
$value = $values->{$this->field_alias};
// Check to see if hiding should happen before adding prefix and suffix.
if ($this->options['hide_empty'] && empty($value) && ($value !== 0 || $this->options['empty_zero'])) {
return '';
}
switch ($this->options['format']) {
case 'raw':
$output = $value;
break;
default:
$output = theme('filefield_meta_samplerate', $value);
}
return check_plain($this->options['prefix']) . $output . check_plain($this->options['suffix']);
}
}

View file

@ -0,0 +1,43 @@
<?php
/**
* @file
* A special handler that renders ID3 tags attached to a file.
*/
/**
* Render a field as a readable value in hours, minutes, and seconds.
*
* @ingroup views_field_handlers
*/
class filefield_meta_handler_field_tags extends views_handler_field {
function option_definition() {
$options = parent::option_definition();
$default = reset(array_keys(filefield_meta_tags()));
$options['tag'] = array('tag' => $default, 'required' => TRUE, 'translatable' => TRUE);
return $options;
}
function options_form(&$form, &$form_state) {
parent::options_form($form, $form_state);
$form['relationship']['#weight'] = -2;
$form['tag'] = array(
'#type' => 'select',
'#title' => t('ID3 tag'),
'#required' => TRUE,
'#default_value' => $this->options['tag'],
'#options' => filefield_meta_tags(),
'#description' => t('Select the tag to be rendered. If needing multiple tags, add another ID3 tags field.'),
'#weight' => -1,
);
}
function render($values) {
$value = unserialize($values->{$this->field_alias});
$tag = $this->options['tag'];
if (isset($value[$tag])) {
return check_plain($value[$tag]);
}
}
}