You are here

function content_storage_type in Content Construction Kit (CCK) 6.3

Same name and namespace in other branches
  1. 6 content.module \content_storage_type()
  2. 6.2 content.module \content_storage_type()

Helper function for identifying the storage type for a field.

3 calls to content_storage_type()
content_field_edit_form_validate in includes/content.admin.inc
Validate a field's settings.
content_field_instance_create in includes/content.crud.inc
Create a new field instance.
content_field_instance_update in includes/content.crud.inc
Update an existing field instance.

File

./content.module, line 1667
Allows administrators to associate custom fields to content types.

Code

function content_storage_type($field) {
  if ($field['multiple'] > 0) {
    return CONTENT_DB_STORAGE_PER_FIELD;
  }
  else {
    module_load_include('inc', 'content', 'includes/content.crud');
    $instances = content_field_instance_read(array(
      'field_name' => $field['field_name'],
    ));
    if (count($instances) > 1) {
      return CONTENT_DB_STORAGE_PER_FIELD;
    }
  }
  return CONTENT_DB_STORAGE_PER_CONTENT_TYPE;
}