You are here

function _scald_flash_create_width_field in Scald: Media Management made easy 7

Create a field to store atom width.

1 call to _scald_flash_create_width_field()
scald_flash_enable in modules/providers/scald_flash/scald_flash.install
Implements hook_enable().

File

modules/providers/scald_flash/scald_flash.install, line 55
Scald Flash Installation

Code

function _scald_flash_create_width_field() {

  // Create the scald_width field.
  if (!field_info_field('scald_width')) {
    $field = array(
      'field_name' => 'scald_width',
      'type' => 'text',
      'label' => t('Width'),
    );
    field_create_field($field);
    $instance = array(
      'field_name' => 'scald_width',
      'label' => t('Width'),
      'entity_type' => 'scald_atom',
      'bundle' => 'flash',
      'required' => FALSE,
    );
    if (!field_read_instance($instance['entity_type'], $instance['field_name'], $instance['bundle'])) {
      field_create_instance($instance);
    }
  }
}