You are here

function bat_type_load in Booking and Availability Management Tools for Drupal 8

Same name and namespace in other branches
  1. 7 modules/bat_unit/bat_unit.module \bat_type_load()

Fetches a Bat Type object.

Parameters

int $type_id: Integer specifying the type id.

bool $reset: A boolean indicating whether the internal cache should be reset.

Return value

\Drupal\bat_unit\Entity\UnitType|null A fully-loaded $type object or NULL if it cannot be loaded.

See also

bat_type_load_multiple()

5 calls to bat_type_load()
BatCalendarReferenceMonthView::viewElements in modules/bat_calendar_reference/src/Plugin/Field/FieldFormatter/BatCalendarReferenceMonthView.php
Builds a renderable array for a field value.
BatCalendarReferenceTimelineView::viewElements in modules/bat_calendar_reference/src/Plugin/Field/FieldFormatter/BatCalendarReferenceTimelineView.php
Builds a renderable array for a field value.
BatCalendarReferenceUnitTypeAutocomplete::formElement in modules/bat_calendar_reference/src/Plugin/Field/FieldWidget/BatCalendarReferenceUnitTypeAutocomplete.php
Returns the form for a single field widget.
BatEventUiBulkUpdateForm::submitForm in modules/bat_event_ui/src/Form/BatEventUiBulkUpdateForm.php
Form submission handler.
BatEventUIController::calendarPage in modules/bat_event_ui/src/Controller/BatEventUIController.php

File

modules/bat_unit/bat_unit.module, line 613
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_type_load($type_id, $reset = FALSE) {
  if ($reset) {
    \Drupal::entityTypeManager()
      ->getStorage('bat_unit_type')
      ->resetCache([
      $type_id,
    ]);
  }
  return UnitType::load($type_id);
}