Some days ago ( 24.April.2012 ) i had to update an existing site . The customer wanted to make some changes like add new data on some cck fields and update some existing modules . According to his proposal i had to give him the option to autocorrect-edit-delete specific cck field values . So after the update the existing cck field : field_building_location ( location area of a building ) should now be used by the 'admin' user for updating etc. The problem was that there were already like 2000 nodes created and those nodes should not be 'edited' . So the big question was : how do we update the cck field values and letting the 'admin' user to update it without problems without letting him go inside the cck fields option page etc . Basically what i did was to build a new vocabulary with the taxonomy module , the new voc will now store the location data . Then i updated the voc. with all the cck fields of the cck field as they were before the update . So for example if the cck field : field_building_location had in his allowed values area the values : Greece , Turkey , Italy , Romania etc . i copy pasted the location values as new taxonomy terms for the new location vocabulary. After i migrated all the values of the cck field to my new vocabulary i edited the "Allowed values / Php Code" section in order to autopopulate the allowed values with the terms of the voc. So now we have the same list with the same values and no harm done . ( Please consider that the old values will not change or be updated with this code , you need an extra update script , for massive node cck field updates . ) Here is the code ( you need to provide the vocabulary id ) name; $terms["$term"] = $term; } return $terms; ?> This is the tricky part The cck values are stored as text-values and not as term ids . So if i change the above code to $terms[$tid] = $term; i will have issues with the cck field because the previous allowed values list where strings and now tid ( integers ) will be used . p.s : If you have any admin access permissions issues click here
Latest Articles
VSCode Drupal Coding Standards Setup (From Scratch)
admin_pixelthi…
Mon, 12/22/2025 - 16:01
22 December 2025
VSCode Drupal Coding Standards Setup (From Scratch)
vscode
Using drupal/core-composer-scaffold to prevent rewriting .htaccess or robots.txt file
admin_pixelthi…
Sun, 12/01/2024 - 16:49
01 December 2024
Using drupal/core-composer-scaffold to prevent rewriting .htaccess or robots.txt file
composer
Controlling ckeditor styling options with hook_editor_js_settings_alter
admin_pixelthi…
Thu, 05/16/2024 - 10:49
16 May 2024