Programatically adding Taxonomy text field This code is throwing a FieldException: Attempt to create a field of unknown type text. in field_create_field() (line 111 of C:\wamp\www\local.test\modules\field\field.crud.inc).

field_cache_clear();

//Create the appropriate field type
$field = array(
    'field_name' =&gt; 'stock_exchange',
    'type' =&gt; 'text',
    'module' =&gt; 'text',
    'active' =&gt; '1',
    'cardinality' =&gt; '1',
    'settings' =&gt; array( 
        'max_length' =&gt; 64 
    )
);
field_create_field($field);

$instance = array(
    'field_name' =&gt; 'stock_exchange',
    'entity_type' =&gt; __DEFAULT_VOCAB_MACHINE_NAME,
    'bundle' =&gt; __DEFAULT_VOCAB_MACHINE_NAME,
    'label' =&gt; 'stock_exchange',
    'description' =&gt; 'stock_exchange',
    'required' =&gt; false,
    'widget' =&gt; array(
        'type' =&gt; 'text_textfield'
    ),
);


At my wits end here trying to figure out why this won't work. Have tried clearing cache and it's not that.

For some reason it's not accepting a basic text field.

Any ideas?
The only way to achieve adding a text field to a Taxonomy Vocabulary is to place it in the hook_enable() function of your module. 

If it's outside of that the "Text" module won't be loaded and you'll receive the error above.

If anyone has a way around that please let me know.