You are here

rooms_booking.api.php in Rooms - Drupal Booking for Hotels, B&Bs and Vacation Rentals 7

This file contains no working PHP code; it exists to provide additional documentation for doxygen as well as to document hooks in the standard Drupal manner.

File

modules/rooms_booking/rooms_booking.api.php
View source
<?php

/**
 * @file
 * This file contains no working PHP code; it exists to provide additional
 * documentation for doxygen as well as to document hooks in the standard
 * Drupal manner.
 */

/**
 * Allows to modify the price modifiers array for a booking.
 *
 * @param array $price_modifiers
 *   Array containing the booking price modifiers.
 * @param array $booking_info
 *   Array containing the booking information. Contains the following key/value
 *   pairs:
 *   - start_date: DateTime object containing the booking start date.
 *   - end_date: DateTime object containing the booking end date. In this case,
 *   the end date represents the last night the unit is blocked, so it is one
 *   day before the checkout date entered in the booking form.
 *   - unit: The RoomsUnit entity the booking is related to.
 *   - booking_parameters: Array containing some other booking parameters:
 *     - group_size: The total number of persons included in the booking.
 *     - group_size_children: The number of children.
 *     - childrens_age: Array containing children's age.
 */
function hook_rooms_price_modifier_alter(&$price_modifiers, $booking_info) {

  // This adds programmatically a 10$ discount.
  $price_modifiers['my_module'] = array(
    '#type' => ROOMS_DYNAMIC_MODIFIER,
    '#quantity' => 1,
    '#op_type' => ROOMS_SUB,
    '#amount' => 10,
  );
}

Functions

Namesort descending Description
hook_rooms_price_modifier_alter Allows to modify the price modifiers array for a booking.