You are here

public function EventManager::eventType in RNG - Events and Registrations 3.x

Same name and namespace in other branches
  1. 8.2 src/EventManager.php \Drupal\rng\EventManager::eventType()
  2. 8 src/EventManager.php \Drupal\rng\EventManager::eventType()

Get event type config for an event bundle.

Use this to test whether an entity bundle is an event type.

Parameters

string $entity_type: An entity type ID.

string $bundle: A bundle ID.

Return value

\Drupal\rng\Entity\EventTypeInterface|null

Overrides EventManagerInterface::eventType

1 call to EventManager::eventType()
EventManager::isEvent in src/EventManager.php
Determines if an entity is an event.

File

src/EventManager.php, line 71

Class

EventManager
Event manager for RNG.

Namespace

Drupal\rng

Code

public function eventType($entity_type, $bundle) {
  $ids = $this->eventTypeStorage
    ->getQuery()
    ->condition('entity_type', $entity_type, '=')
    ->condition('bundle', $bundle, '=')
    ->execute();
  if ($ids) {
    return $this->eventTypeStorage
      ->load(reset($ids));
  }
  return NULL;
}