You are here

function _scald_flash_create_height_field in Scald: Media Management made easy 7

Create a field to store atom height.

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

File

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

Code

function _scald_flash_create_height_field() {

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