You are here

function field_kaltura_field_settings in Kaltura 6

Same name and namespace in other branches
  1. 5 plugins/field_kaltura/field_kaltura.module \field_kaltura_field_settings()
  2. 6.2 plugins/field_kaltura/field_kaltura.module \field_kaltura_field_settings()

Implementation of hook_field_settings().

File

plugins/field_kaltura/field_kaltura.module, line 57
kaltura integration module - functions to provide kaltura as CCK field

Code

function field_kaltura_field_settings($op, $field) {
  switch ($op) {
    case 'form':
      $form = array();

      // specific field setting can come here (taxonomy integration/player selection/etc...)
      $form['thumbsize'] = array(
        '#type' => 'fieldset',
        '#title' => t('Thumbnail Dimensions'),
        '#description' => t('Note - these settings will only apply when choosing "Thumbnail" display'),
      );
      $form['thumbsize']['thumbsize_width'] = array(
        '#type' => 'textfield',
        '#title' => t('Thumbnail Width'),
        '#size' => 5,
        '#default_value' => !empty($field['thumbsize_width']) ? $field['thumbsize_width'] : '',
      );
      $form['thumbsize']['thumbsize_height'] = array(
        '#type' => 'textfield',
        '#title' => t('Thumbnail Height'),
        '#size' => 5,
        '#default_value' => !empty($field['thumbsize_height']) ? $field['thumbsize_height'] : '',
      );
      return $form;
    case 'save':
      return array(
        'allowed_values',
        'allowed_values_php',
        'thumbsize_height',
        'thumbsize_width',
      );
    case 'database columns':
      $columns['value'] = array(
        'type' => 'text',
        'size' => 'big',
        'not null' => FALSE,
        'sortable' => TRUE,
      );
      return $columns;
    case 'views data':
      $allowed_values = content_allowed_values($field);
      if (count($allowed_values) || 1) {
        $data = content_views_field_views_data($field);
        $db_info = content_database_info($field);
        $table_alias = content_views_tablename($field);

        // Filter: Add a 'many to one' filter.
        $copy = $data[$table_alias][$field['field_name'] . '_value'];
        $copy['title'] = t('@label (!name) - Allowed values', array(
          '@label' => t($field['widget']['label']),
          '!name' => $field['field_name'],
        ));
        $copy['filter']['handler'] = 'content_handler_filter_many_to_one';
        unset($copy['field'], $copy['argument'], $copy['sort']);
        $data[$table_alias][$field['field_name'] . '_value_many_to_one'] = $copy;

        // Argument : swap the handler to the 'many to one' operator.
        $data[$table_alias][$field['field_name'] . '_value']['argument']['handler'] = 'content_handler_argument_many_to_one';
        return $data;
      }
  }
}