Getting the following error on install:

FieldException: Cannot change an existing field's type. in field_update_field() (Line 234 in /srv/www/vhosts/.../htdocs/modules/field/field.crud.inc).

Comments

kreynen’s picture

Status: Active » Needs work

I will update this soon. The issue is that you already have a field with the same name as the one of the fields defined in the Feature part of this module. The fields are currently named...

field_sub_head
field_slideshow_image
field_weight

I'm adjusting these field names to...

field_cm_sub_head
field_cm_slideshow_image
field_cm_weight

kreynen’s picture

Status: Needs work » Needs review
one2gov’s picture

Change this line (234) with:
if ( ! array_key_exists('distribution_name', $info)) $info['distribution_name'] = 'Drupal';
return $info['distribution_name'];

also working with a few more similar fieldException

serg2’s picture

I receive this error when enabling "Isotope Example 7.x-2.x-dev". Once enabling the module the only way to remove the error is to delete the module.

Line 233 & 234 of field.crud.inc is:

 if ($field['type'] != $prior_field['type']) {
    throw new FieldException("Cannot change an existing field's type.");

Should I replace 233 & 234 with :

if ( ! array_key_exists('distribution_name', $info)) $info['distribution_name'] = 'Drupal';
return $info['distribution_name'];
kreynen’s picture

Status: Needs review » Closed (works as designed)

The original version of cm_slideshow used a Feature to create it's fields. isotope_example is still an exported Feature and will remain that way, but cm_slideshow has been changed. If you try to enable a Feature and it attempts to create a field that already exists, you get this error. This is an issue for the Features module, not modules that include a Feature.

This type of issue has always been a problem for Features. Unlike module development where the developer should prefix any fields they create based on with the Drupal.org project name, you can call a Feature anything. When the first Features developed, several were called image_gallery with a field called image_field. Even if the image galleries used a different name for their Features like devseed_image_gallery and pingv_image_gallery, if they both use image_field you'll get this error.

Sorry, but there is not much that can be done about this at the module level.

serg2’s picture

Thank you for the explanation