Now all modules are in core modules folder

This commit is contained in:
Manuel Cillero 2017-08-08 12:14:45 +02:00
parent 5ba1cdfa0b
commit 05b6a91b0c
1907 changed files with 0 additions and 0 deletions

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]);
}
}
}