You are here

function bat_event_get_types in Booking and Availability Management Tools for Drupal 8

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

Gets an array of all event types, keyed by the type name.

Parameters

string $type_name: If set, the type with the given name is returned.

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

Return value

\Drupal\bat_event\Entity\EventType[] Depending whether $type isset, an array of event types or a single one.

12 calls to bat_event_get_types()
BatEventUiEventTypeForm::buildForm in modules/bat_event_ui/src/Form/BatEventUiEventTypeForm.php
Form constructor.
BatStateWidget::buildConfigurationForm in modules/bat_facets/src/Plugin/facets/widget/BatStateWidget.php
Provides a configuration form for this widget.
BatTypeHandlerTypeCalendarsField::render in modules/bat_unit/src/Plugin/views/field/BatTypeHandlerTypeCalendarsField.php
Renders the field.
bat_event_form_bat_type_bundle_edit_form_alter in modules/bat_event/bat_event.module
Implements hook_form_FORM_ID_alter().
bat_event_series_install in modules/bat_event_series/bat_event_series.install
Implements hook_install().

... See full list

File

modules/bat_event/bat_event.module, line 320
Manage Events - Events store the EventValue of a Unit over a period of time.

Code

function bat_event_get_types($type_name = NULL, $reset = FALSE) {
  if ($reset) {
    \Drupal::entityTypeManager()
      ->getStorage('bat_event_type')
      ->resetCache();
  }
  $types = EventType::loadMultiple();
  return isset($type_name) ? $types[$type_name] : $types;
}