You are here

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

Adds "Booking Options" field to the rooms_booking_manager_line_item.

File

modules/rooms_booking_manager/rooms_booking_manager.install, line 174
Install for Rooms Booking Manager module

Code

function rooms_booking_manager_update_7003() {

  // Clear the field cache so that the rooms_options field type will be
  // available.
  field_cache_clear();
  $field = array(
    'field_name' => 'rooms_booking_options',
    'label' => t('Booking Options'),
    'cardinality' => -1,
    'required' => 0,
    'type' => 'rooms_options',
    'module' => 'rooms',
    'settings' => array(
      'user_register_form' => FALSE,
    ),
    'widget' => array(
      'active' => 0,
      'module' => 'rooms',
      'settings' => array(),
      'type' => 'rooms_options_combined',
      'weight' => '0',
    ),
  );
  field_create_field($field);
  $instance = array(
    'field_name' => 'rooms_booking_options',
    'label' => t('Booking Options'),
    'entity_type' => 'commerce_line_item',
    'bundle' => 'rooms_booking',
    'default_value' => NULL,
    'deleted' => '0',
    'description' => '',
    'display' => array(
      'default' => array(
        'label' => 'above',
        'module' => NULL,
        'settings' => array(),
        'type' => 'rooms_options_default',
        'weight' => 12,
      ),
      'teaser' => array(
        'label' => 'above',
        'settings' => array(),
        'type' => 'hidden',
        'weight' => 0,
      ),
    ),
    'required' => 0,
    'settings' => array(
      'user_register_form' => FALSE,
    ),
    'widget' => array(
      'module' => 'rooms_unit',
      'type' => 'rooms_options_combined',
    ),
  );
  field_create_instance($instance);
}