Hi everybody,
I am pretty new to Drupal and about to get involved deeper. And now I encounter this problem using the Rules-module.
First I have written this module, that creates a new node-type and adds some fields to it:
<?php
function roombooking_install() {
$t = get_t();
// Add body
node_types_rebuild();
$types = node_type_get_types();
node_add_body_field($types['roomtype'], $t('Description'));
$body_instance = field_info_instance('node','body','roomtype');
$body_instance['display']['full'] = array(
'label' => 'hidden',
'type' => 'text_summary_or_trimmed',
);
field_update_instance($body_instance);
foreach(_roomtype_installed_fields() as $field) {
//Create fields
field_create_field($field);
}
foreach(_roomtype_installed_instances() as $instance) {
$instance['entity_type'] = 'node';
$instance['bundle'] = 'roomtype';
//Create instances and add Roomtype
field_create_instance($instance);
}
}
/*
* Array of fields for roomtype
*/
function _roomtype_installed_fields() {
$t = get_t();
return array(
'roomtype_image' => array(
'field_name' => 'roomtype_image',
'type' => 'image',
'cardinality' => 1,
),