You are here

function emvideo_field_settings in Embedded Media Field 6

Same name and namespace in other branches
  1. 6.3 contrib/emvideo/emvideo.module \emvideo_field_settings()
  2. 6.2 contrib/emvideo/emvideo.module \emvideo_field_settings()

Implementation of hook_field_settings().

File

contrib/emvideo/emvideo.module, line 224
Embedded Video module is a handler for 3rd party video files.

Code

function emvideo_field_settings($op, $field) {
  switch ($op) {
    case 'views data':
      $data = emfield_emfield_field_settings($op, $field);
      $table_alias = content_views_tablename($field);
      $field_duration = $field['field_name'] . '_duration';
      $data[$table_alias][$field_duration] = $data[$table_alias][$field['field_name'] . '_embed'];
      $data[$table_alias][$field_duration]['title'] .= t(' - Duration');
      $data[$table_alias][$field_duration]['field']['title'] = $data[$table_alias][$field_duration]['title'];
      $data[$table_alias][$field_duration]['title short'] = t('Duration');
      $data[$table_alias][$field_duration]['field']['title short'] = $data[$table_alias][$field_duration]['title short'];
      $data[$table_alias][$field_duration]['field']['field'] = $field_duration;
      $data[$table_alias][$field_duration]['field']['handler'] = 'emvideo_handler_field_duration';
      $data[$table_alias][$field_duration]['argument']['field'] = $field_duration;
      $data[$table_alias][$field_duration]['argument']['handler'] = 'emvideo_handler_argument_duration';
      $data[$table_alias][$field_duration]['filter']['field'] = $field_duration;
      $data[$table_alias][$field_duration]['filter']['handler'] = 'content_handler_filter_numeric';
      $data[$table_alias][$field_duration]['sort']['field'] = $field_duration;
      return $data;
    case 'database columns':
      $columns = emfield_emfield_field_settings($op, $field);

      // Store duration in its own column for views.
      $columns = array_merge($columns, array(
        'duration' => array(
          'description' => t('Store the duration of a video in seconds.'),
          'type' => 'int',
          'unsigned' => TRUE,
          'not null' => TRUE,
          'default' => 0,
        ),
      ));
      return $columns;
    default:
      return emfield_emfield_field_settings($op, $field);
  }
}