contacts_events-8.x-1.x-dev/modules/village_allocation/village_allocation.module
modules/village_allocation/village_allocation.module
<?php
/**
* @file
* Contains village_allocation.module.
*/
use Drupal\Core\Entity\EntityInterface;
/**
* Implements hook_theme().
*/
function village_allocation_theme() {
// Custom template for the manual VA page.
$theme['village_allocation'] = [
'render element' => 'build',
];
return $theme;
}
/**
* Implements hook_ENTITY_TYPE_insert() for commerce_order.
*/
function village_allocation_commerce_order_insert(EntityInterface $entity) {
// Ensure camping groups are re-indexed if a booking in the group changes.
if ($entity->bundle() == 'contacts_booking') {
/** @var \Drupal\village_allocation\VillageGroupIndexer $indexer */
$indexer = \Drupal::service('village_allocation.indexer');
$indexer->reindexGroupForBooking($entity);
}
}
/**
* Implements hook_ENTITY_TYPE_update() for commerce order.
*/
function village_allocation_commerce_order_update(EntityInterface $entity) {
// Ensure camping groups are re-indexed if a booking in the group changes.
if ($entity->bundle() == 'contacts_booking') {
/** @var \Drupal\village_allocation\VillageGroupIndexer $indexer */
$indexer = \Drupal::service('village_allocation.indexer');
$indexer->reindexGroupForBooking($entity);
}
}
