You are here

function field_permission_example_field_schema in Examples for Developers 7

Implements hook_field_schema().

Defines the database schema of the field, using the format used by the Schema API.

We only want a simple text field, similar to the body of a node.

Note that this field has only a normal text (which translates to 16k of text in MySQL), and so therefore doesn't have an index. More complex schema would probably have at least one indexed column.

See also

http://drupal.org/node/146939

Schema API

hook_field_schema()

Related topics

File

field_permission_example/field_permission_example.install, line 25
Install function for the field_permission_example module.

Code

function field_permission_example_field_schema($field) {
  $columns = array(
    'notes' => array(
      'type' => 'text',
      'size' => 'normal',
      'not null' => FALSE,
    ),
  );
  return array(
    'columns' => $columns,
  );
}