You are here

protected static function CalendarEvent::getCalendarEventType in Opigno calendar event 8

Same name and namespace in other branches
  1. 3.x src/Entity/CalendarEvent.php \Drupal\opigno_calendar_event\Entity\CalendarEvent::getCalendarEventType()

Returns a calendar event type entity.

Parameters

string $type_id: The calendar event type ID.

Return value

\Drupal\Core\Config\Entity\ConfigEntityInterface The calendar event entity.

2 calls to CalendarEvent::getCalendarEventType()
CalendarEvent::bundleFieldDefinitions in src/Entity/CalendarEvent.php
Provides field definitions for a specific bundle.
CalendarEvent::getDateItems in src/Entity/CalendarEvent.php
Returns the calendar event date items.

File

src/Entity/CalendarEvent.php, line 150

Class

CalendarEvent
Defines the "Calendar event" entity class.

Namespace

Drupal\opigno_calendar_event\Entity

Code

protected static function getCalendarEventType($type_id) {
  try {

    /** @var \Drupal\Core\Config\Entity\ConfigEntityInterface $type */
    $type = \Drupal::entityTypeManager()
      ->getStorage('opigno_calendar_event_type')
      ->load($type_id);
  } catch (InvalidPluginDefinitionException $e) {
    throw new \RuntimeException($e
      ->getMessage(), $e
      ->getCode(), $e);
  }
  return $type;
}