You are here

protected function AvailabilityAgent::orderByOptionals in Rooms - Drupal Booking for Hotels, B&Bs and Vacation Rentals 7

Ordering units by the optional items that are available.

Parameters

array $units: Units to sort.

Return value

array Sorted units by number of options.

1 call to AvailabilityAgent::orderByOptionals()
AvailabilityAgent::getUnitsByPriceType in modules/rooms_booking/includes/rooms_booking.availability_agent.inc
Returns the units array in a specific format based on price.

File

modules/rooms_booking/includes/rooms_booking.availability_agent.inc, line 426
Contains the AvailabilityAgent.

Class

AvailabilityAgent
An AvailabilityAgent provides access to the availability functionality of Rooms and lets you query for availability, get pricing information and create products that can be bought.

Code

protected function orderByOptionals($units) {
  foreach ($units as $type => $v) {
    foreach ($v as $price => $value) {
      uasort($value, array(
        get_class($this),
        'compareByOptionals',
      ));
      $units[$type][$price] = $value;
    }
  }
  return $units;
}