You are here

public function SerialFields::create in Serial Field 7

Create fields.

Return value

self Object instance.

Throws

\FieldException When cannot create a field.

File

tests/serial.fields.inc, line 34
Serial (Fields Helper).

Class

SerialFields
Class SerialFields.

Code

public function create() {
  foreach ($this->fields as $name => $data) {
    if (!db_table_exists("field_data_{$name}")) {
      field_create_field($data + array(
        'default' => '',
        'not null' => TRUE,
        'field_name' => $name,
      ));
    }
  }
  return $this;
}