0

I am building a custom installation profile. I am trying to create a field on module installation of type list_text. I have the 'list' dependency inside of my profiles .info file, and it's ahead of the module I am trying to enable. When the installation profile starts installing, I get the error 'Unable to create field of unknown type 'list_text'. Here are the settings I am using in the .module file

 $field = array(
  'field_name' => 'field_country',
  'type' => 'list_text',
  'cardinality' => 1,
);
field_create_field($field);

$instance = array(
  'field_name' => 'field_country',
  'entity_type' => 'user',
  'bundle' => 'user', // If your entity does not have bundles, this is the same as the entity type.
  'label' => 'Country',
  'required' => TRUE, // Field must have a value.
  'options' => $countries,
  'widget' => array(
    'type' => 'options_select',
  ),
);

I am also creating a couple of other fields on module installation, too (of type 'text'), and they are being created. Since both field types are enabled by the same modules (the 'field' module, and the 'list' sub-module), and the text fields are being created, I cannot troubleshoot why the error is occurring. If I change the type to 'text' and widget type to 'text_textfield' the field is created successfully.

Also, the Drupal installation profile (even the standard one), uses select lists for specifying the region and timezone of the default user, so the list module has to be working. Am I doing something wrong?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.