$entity_type, 'field_name' => 'field_test_text', 'type' => 'text', 'cardinality' => 1, ))->save(); entity_create('field_config', array( 'entity_type' => $entity_type, 'field_name' => 'field_test_text', 'bundle' => $entity_type, 'label' => 'Test text-field', 'translatable' => FALSE, ))->save(); entity_get_form_display($entity_type, $entity_type, 'default') ->setComponent('field_test_text', array('type' => 'text_textfield')) ->save(); } } /** * Implements hook_schema(). */ function entity_test_schema() { // Schema for simple entity. $schema['entity_test_example'] = array( 'description' => 'Stores entity_test items.', 'fields' => array( 'id' => array( 'type' => 'serial', 'not null' => TRUE, 'description' => 'Primary Key: Unique entity-test item ID.', ), ), 'primary key' => array('id'), ); return $schema; }