You are here

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

Allows modules to use contextual information about bookings to change what is shown to the user.

Parameters

&$string_suggestions - String suggestions, the suggestion with the: highest index in the array will be used. The value at index 0 is the default value.

$context - Contextual information about the string.:

Return value

mixed

1 function implements hook_rooms_string_alter()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

rooms_periodic_pricing_rooms_string_alter in modules/rooms_pricing/modules/rooms_periodic_pricing/rooms_periodic_pricing.module
Implements hook_rooms_string_alter().
1 invocation of hook_rooms_string_alter()
rooms_string in ./rooms.module
A string transformation function specific to Rooms to allow modules to use contextual information about bookings to change what is shown to the user.

File

./rooms.api.php, line 88
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.

Code

function hook_rooms_string_alter(&$string_suggestions, $context) {
  if ($context['#purpose'] == 'rooms_create_line_item') {

    // Alter the line item label to add additional information about the unit.
    $string_suggestions[] = $string_suggestions[0] . ' maximum guests: ' . $context['#data']['unit']['unit']->max_sleeps;
  }
}