Standardized way to add node content during an install profile execution

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
ingo86's picture

Hi all.
I am looking for a standardized way to add contents such as any type of nodes into an installation profile.
Suppose you wanna build an instal profile that creates some pages and a contact form, you have to add this pages as arrays and use a function like node_save to add them into the database. This make the profile file really long or you have to split it into more than one file (but it seems there's no standard way to manage them).
Symfony call this feature "fixtures" and does it in a quite elegant way, using yaml and enabling the developer of using php directly into this yml file for loops and subroutines.

Any solution for doing that with drupal?

Comments

Interested as well

yourpal's picture

If I understand correctly I am interested in learning how this is done in Drupal as well. I am new to Drupal coming from Joomla 1.5 which upon install allows you to auto insert 'dummy' pages with pre filled in photos and text and forms, etc. I have no idea how to do this in Drupal if it is possible.

Features

doka's picture

Not 100% what you are searching for, but worth to check this module: http://drupal.org/project/features

node export?

snufkin's picture

Features can not export nodes sadly. The only content I could export was boxes. I've got the same problem at the moment, I was suggested to try the node export module to get the php code for the node, and use its api to re-create it in the install process.

http://drupal.org/project/node_export

Update: I wrote about it here: http://longlake.co.uk/blogs/balazs/generating-content-install

node_export + install_profile_api

jonhattan's picture

You can do your nodes, export them with node_export to a file and in the install profile, by using install_profile_api, do:

install_node_export_import_from_file('fixtures/nodes.export');

For features integration there's a request in node_export issue queue: http://drupal.org/node/753544 and there's also a request in exportables issue queue: http://drupal.org/node/698526

Node export might be the best

kostajh's picture

Node export might be the best option. Does anyone know if this works for CCK fields though? I am having trouble programmatically creating CCK content during the install profile process, because the necessary tables for the fields and content types don't yet exist.

.

frob's picture

.

Distributions

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week