function bat_unit_load in Booking and Availability Management Tools for Drupal 8
Same name and namespace in other branches
- 7 modules/bat_unit/bat_unit.module \bat_unit_load()
Fetches a unit object.
Parameters
int $unit_id: Integer specifying the unit id.
bool $reset: A boolean indicating whether the internal cache should be reset.
Return value
\Drupal\bat_unit\Entity\Unit|null A fully-loaded $unit object or NULL if it cannot be loaded.
See also
6 calls to bat_unit_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.
- BatCalendarReferenceUnitAutocomplete::formElement in modules/
bat_calendar_reference/ src/ Plugin/ Field/ FieldWidget/ BatCalendarReferenceUnitAutocomplete.php - Returns the form for a single field widget.
- BatUnitAutocompleteMatcher::getMatches in modules/
bat_calendar_reference/ src/ BatUnitAutocompleteMatcher.php - Gets matched labels based on a given search string.
- FullCalendarFixedStateEventFormatter::format in modules/
bat_fullcalendar/ src/ FullCalendarFixedStateEventFormatter.php
File
- modules/
bat_unit/ bat_unit.module, line 304 - 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_load($unit_id, $reset = FALSE) {
if ($reset) {
\Drupal::entityTypeManager()
->getStorage('bat_unit')
->resetCache([
$unit_id,
]);
}
return Unit::load($unit_id);
}