Hi,

I just try to create a taxonomy term field, but the setting 'vocabulary' don't want to be loaded in the field created, as result when I want to add a taxonomy term to a node, that's go in error ...

Here is my code :

    $vocabulary=taxonomy_vocabulary_load('2');
    $field = array(
        'field_name' => $myField_name, 
        'type' => 'taxonomy_term_reference',
        'cardinality' => '-1',
        'settings' => array(0 => array('vocabulary' => $vocabulary->machine_name, 'parent'=> 0)));
    field_create_field($field);

Any idea, how I can put this vocabulary value in the field ?

Comments

Tazzz’s picture

founded .

Missing 'allowed_values' .... 2 days for finding it ;)

Sorry.

regards.