I’ve been experimenting with the Drupal Content Construction Kit, which promised to be a more flexible way to deal with custom node types in the Drupal content management system. However, I’m a finicky sort of person who likes being able to reproduce the setup from a fresh start, and CCK isn’t well-known for that. In fact, CCK nodes aren’t well-known for being easy to move from one server to another.

I was using Path to define aliases for my nodes and the path aliases were just not getting created. After lots and lots of tracing with XDebug, I found out that it was checking for user_access, but no user was active during the installation process. Solution: create the admin user and load it into a global $user variable.

I also spent a fair bit of time being very annoyed with CCK and creating nodes programmatically in my install profile. Turns out that you first need to use install_add_content_type to create the base node type, _then_ follow the instructions to drupal_execute the form that adds custom fields.

Hi Sacha — great posts on your experimentation with install profiles recently. I originally wrote install_profile_api — recall that all the install_ functions are essentially helper functions as we wait for Drupal core to gain its own data setters / getters.

Hi!
Thanks for your instructions.
I used them to create install profile for one of my sites.
But I have the following problem with it:
When I try to set value for one of my CCK fields which has ‘Select list’ type,
the value is ignored.
Here is my code:

$values[“field_order_provider”][0][“value”] = $row[“Provider”];

For nodes are created by hands the field looks like this:

field_order_provider
Array
(
[0] => Array
(
[value] => 1
)
)

Any ideas?

http://coders.co.nz dman

Thanks for this starter!

I’m now just copying the export wizard text output directly into a file I distribute with my profile, and then invoking it!
I don’t need to make the content type beforehand – it all comes together.

Plus some updates for todays version of CCK.
_install_create_content_from_file(dirname(__FILE__). '/speciespage.content-type.php');