5 * Token integration for FileField Meta.
9 * Implementation of hook_token_list().
11 * Provide a user readable list of FileField Meta tokens.
13 function filefield_meta_token_list($type = 'all') {
14 if ($type == 'field' || $type == 'all') {
15 $tokens['file']['filefield-width'] = t('File Video width');
16 $tokens['file']['filefield-height'] = t('File Video height');
17 $tokens['file']['filefield-duration'] = t('File Duration');
18 $tokens['file']['filefield-audio-format'] = t('File Audio Format path');
19 $tokens['file']['filefield-audio-sample-rate'] = t('File Audio sample rate');
20 $tokens['file']['filefield-audio-channel-mode'] = t('File Audio channel mode (stereo, mono)');
21 $tokens['file']['filefield-audio-bitrate'] = t('File Audio bitrate');
22 $tokens['file']['filefield-audio-bitrate-mode'] = t('File Audio bitrate mode (cbr, vbr, abr...)');
25 foreach (filefield_meta_tags() as
$tag => $label) {
26 $tokens['file']['filefield-tag-' .
$tag] = t('File ID3 @tag tag', array('@tag' => $label));
34 * Implementation of hook_token_values().
36 * Provide the token values for a given file item.
38 function filefield_meta_token_values($type, $object = NULL
) {
40 if ($type == 'field' && isset($object[0]['fid'])) {
43 $tokens['filefield-width'] = $item['data']['width'] ;
44 $tokens['filefield-height'] = $item['data']['height'] ;
45 $tokens['filefield-duration'] = $item['data']['duration'] ;
46 $tokens['filefield-audio-format'] = isset($item['data']['audio_format']) ?
check_plain($item['data']['audio_format']) : '';
47 $tokens['filefield-audio-sample-rate'] = isset($item['data']['sample_rate']) ?
check_plain($item['data']['sample_rate']) : '';
48 $tokens['filefield-audio-channel-mode'] = isset($item['data']['audio_channel_mode']) ?
check_plain($item['data']['audio_channel_mode']) : '';
49 $tokens['filefield-audio-bitrate'] = isset($item['data']['audio_bitrate']) ?
check_plain($item['data']['audio_bitrate']) : '';
50 $tokens['filefield-audio-bitrate-mode'] = isset($item['data']['audio_bitrate_mode']) ?
check_plain($item['data']['audio_bitrate_mode']) : '';
53 foreach (filefield_meta_tags() as
$tag => $label) {
54 $tokens['filefield-tag-title'] = isset($item['data']['tags'][$tag]) ?
check_plain($item['data']['tags'][$tag]) : '';