You are here

function bat_unit_query_bat_unit_type_access_alter in Booking and Availability Management Tools for Drupal 8

Implements hook_query_TAG_alter().

File

modules/bat_unit/bat_unit.module, line 49
Manage units - Units are things that can be booked for some period of time. (e.g. rooms - but also villas bungalows, cars, drills, you-get-the-idea etc.)

Code

function bat_unit_query_bat_unit_type_access_alter(AlterableInterface $query) {

  // Look for an type base table to pass to the query altering function or else
  // assume we don't have the tables we need to establish order related altering
  // right now.
  foreach ($query
    ->getTables() as $table) {
    if ($table['table'] === 'unit_type') {
      bat_entity_access_query_alter($query, 'bat_unit_type', $table['alias']);
      break;
    }
  }
}