You are here

function rooms_description_content_type_install in Rooms - Drupal Booking for Hotels, B&Bs and Vacation Rentals 7

Creates content type for rooms unit type description.

2 calls to rooms_description_content_type_install()
rooms_unit_install in modules/rooms_unit/rooms_unit.install
Implements hook_install().
rooms_unit_update_7002 in modules/rooms_unit/rooms_unit.install
Creates rooms_description content type.

File

modules/rooms_unit/rooms_unit.install, line 234
Sets up the base table for our entity and a table to store information about the entity types.

Code

function rooms_description_content_type_install() {
  $t = get_t();

  // We define the node type as an associative array.
  if (!in_array('unit_description', node_type_get_names())) {
    $unit_description = array(
      'type' => 'unit_description',
      'name' => $t('Unit Description'),
      'base' => 'node_content',
      'description' => $t('Bookable Unit Description.'),
      'title_label' => $t('Title'),
      'custom' => TRUE,
    );
  }
  $content_type = node_type_set_defaults($unit_description);
  foreach (_rooms_description_installed_fields() as $field) {
    field_create_field($field);
  }
  foreach (_rooms_description_installed_instances() as $instance) {
    $instance['entity_type'] = 'node';
    $instance['bundle'] = $unit_description['type'];
    field_create_instance($instance);
  }
  node_type_save($content_type);
}