You are here

function brightcove_cck_field_settings in Brightcove Video Connect 6

Same name and namespace in other branches
  1. 6.2 brightcove_cck/brightcove_cck.module \brightcove_cck_field_settings()

Implementation of hook_field_settings().

File

brightcove_cck/brightcove_cck.module, line 133
Brightcove CCK module provides a Content Construction Kit module to developers, allowing them to browse videos in their Brightcove Studio and upload them.

Code

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

      // Only allow Upload if this site has Write API keys.
      if (brightcove_write_api_access()) {
        $form['allow_upload'] = array(
          '#type' => 'checkbox',
          '#title' => t('Allow upload'),
          '#description' => t('Whether to allow uploading new videos to Brightcove Studio from this field. Requires Write API keys with at least a <a href="http://www.brightcove.com/en/video-platform/editions-and-pricing">Professional account</a>.'),
          '#default_value' => $field['allow_upload'],
        );
      }
      return $form;
    case 'save':
      $settings = array(
        'allow_upload',
      );
      return $settings;
    case 'database columns':

      // We only save video_id as it's the only stable value in the video -
      // anything else might change and we won't be able to easily detect it.
      $columns = array(
        'video_id' => array(
          'type' => 'varchar',
          'length' => 15,
          'not null' => FALSE,
          'index' => TRUE,
        ),
      );
      return $columns;
    case 'views data':
      include_once drupal_get_path('module', 'brightcove_cck') . '/views/brightcove_cck.views.inc';
      $data = _brightcove_cck_views_data($field);
      return $data;
  }
}