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