You are here

function _emfield_field_columns in Embedded Media Field 6

Same name and namespace in other branches
  1. 6.3 emfield.cck.inc \_emfield_field_columns()
  2. 6.3 deprecated/emfield-deprecated.cck.inc \_emfield_field_columns()
  3. 6.2 emfield.cck.inc \_emfield_field_columns()

Helper function to consistantly define field columns.

1 call to _emfield_field_columns()
emfield_field_columns in ./emfield.module

File

./emfield.cck.inc, line 12
Helper functions to implement our various cck-required functions, such as hook_field and hook_widget.

Code

function _emfield_field_columns($field) {
  $columns = array(
    // This contains the original URL or embed code pre-parsing,
    // as entered by the user/editor.
    'embed' => array(
      'type' => 'text',
      'size' => 'big',
      'not null' => TRUE,
      'not null' => FALSE,
      'sortable' => TRUE,
    ),
    // This contains the code used by the provider to identify the media.
    'value' => array(
      'type' => 'varchar',
      'length' => 255,
      'not null' => TRUE,
      'not null' => FALSE,
      'sortable' => TRUE,
    ),
    // This is the actual provider used;
    // matches up with the specific provider.inc file.
    'provider' => array(
      'type' => 'varchar',
      'length' => 255,
      'not null' => TRUE,
      'not null' => FALSE,
      'sortable' => TRUE,
    ),
    // An array for any extra data required by this media,
    // such as unique thumbnail requirements or rss feed data.
    'data' => array(
      'type' => 'text',
      'size' => 'big',
      'not null' => TRUE,
      'not null' => FALSE,
      'sortable' => FALSE,
    ),
    // The version of the provider's data, as an integer. In general, this
    // number will be increased incrementally as changes to the API are
    // introduced, or the module introduces or requires new data.
    // Emfield uses this periodically in its updates.
    'version' => array(
      'description' => t("The version of the provider's data."),
      'type' => 'int',
      'unsigned' => TRUE,
      'not null' => TRUE,
      'default' => 0,
    ),
  );

  // Allow other modules to add new columns.
  $columns = array_merge($columns, module_invoke_all('emfield_field_columns_extra', $field));
  return $columns;
}