getid3_metadata_audio_sample_rate.inc in getID3() 7.2
File
includes/handlers/getid3_metadata_audio_sample_rate.inc
View source
<?php
class getid3_metadata_audio_sample_rate extends getid3_metadata_handler {
function option_definition() {
$options = parent::option_definition();
$options['format'] = array(
'default' => 'default',
'translatable' => TRUE,
);
unset($options['separator']);
return $options;
}
function options_form(&$form, &$form_state) {
parent::options_form($form, $form_state);
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) {
$rendered_values = parent::render($values);
$value = $rendered_values['audio_sample_rate'];
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('getid3_sample_rate', array(
'sample_rate' => $value,
));
}
return $this
->sanitize_value($this->options['prefix']) . $output . $this
->sanitize_value($this->options['suffix']);
}
}