You are here

function eck_property_type_schema in Entity Construction Kit (ECK) 7.2

The property types schemas.

2 calls to eck_property_type_schema()
eck_set_properties_schema in ./eck.properties.inc
Assigns fields to the db schema for an entity type.
EntityType::save in ./eck.classes.inc
Save.

File

./eck.properties.inc, line 52
Handles properties attached to entites created through ECK.

Code

function eck_property_type_schema($type) {
  $schema = array();
  switch ($type) {
    case 'text':
      $schema = array(
        'description' => 'Text',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      );
      break;
    case 'decimal':
      $schema = array(
        'description' => 'Decimal',
        'type' => 'float',
        'not null' => TRUE,
        'default' => 0,
      );
      break;
    case 'integer':
      $schema = array(
        'type' => 'int',
        'description' => "Integer",
        'not null' => TRUE,
        'default' => 0,
      );
      break;
    case 'positive_integer':
      $schema = array(
        'type' => 'int',
        'description' => "Integer",
        'not null' => TRUE,
        'unsigned' => TRUE,
        'default' => 0,
      );
      break;
    case 'uuid':
      $schema = array(
        'type' => 'char',
        'length' => 36,
        'not null' => TRUE,
        'default' => '',
        'description' => 'The Universally Unique Identifier.',
      );
      break;
    case 'language':
      $schema = array(
        'description' => 'Language',
        'type' => 'varchar',
        'length' => 12,
        'not null' => TRUE,
        'default' => '',
      );
      break;
    default:
      $schema = NULL;
      break;
  }

  // @todo Don't really like this.
  drupal_alter('eck_property_type_schema', $schema, $type);
  return $schema;
}