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).


//Create the appropriate field type
$field = array(
    'field_name' => 'stock_exchange',
    'type' => 'text',
    'module' => 'text',
    'active' => '1',
    'cardinality' => '1',
    'settings' => array( 
        'max_length' => 64 

$instance = array(
    'field_name' => 'stock_exchange',
    'entity_type' => __DEFAULT_VOCAB_MACHINE_NAME,
    'label' => 'stock_exchange',
    'description' => 'stock_exchange',
    'required' => false,
    'widget' => array(
        'type' => '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?

  • At a guess, you have the Text module disabled
    – Clive
    Nov 6, 2014 at 16:04
  • Appreciate the response @Clive. Text module is enabled: d.pr/i/osyb
    – ryanka
    Nov 6, 2014 at 16:12
  • That's mighty strange - what do you get as output for field_info_field_types('text')? It should be an array with 10 or so items representing the text field type. Sounds like that's missing; do you have any custom/contrib modules that might be implementing hook_field_info_alter() and doing something to displace the core text type?
    – Clive
    Nov 6, 2014 at 16:16
  • @Clive My thoughts exactly. The output is null. Just checked all of the contrib modules I have and none of them use that hook. I can create all of the fields with number_decimal as the type and it works. For some reason the text field has disappeared on me.
    – ryanka
    Nov 6, 2014 at 16:20
  • Wow. What about module_invoke_all('field_info'), does that contain the text field type?
    – Clive
    Nov 6, 2014 at 16:50

1 Answer 1


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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.