Skip to content

Class Events

Extends Component

Constants

EVENT_REGISTER_TYPES

See RegisterEventTypesEvent

EVENT_REGISTER_SOURCES

See RegisterEventSourcesEvent

EVENT_DEFINE_ORGANIZER_QUERY

See DefineOrganizerQueryEvent

Methods

findDateField

public findDateField(ElementInterface|FieldLayoutProviderInterface $type): ?EventDate
$type ElementInterface|FieldLayoutProviderInterface
return ?EventDate

getTypes

public getTypes(): array
return array

getSources

public getSources(): array<string,EventSource>
return array<string,EventSource>

findSourceByKey

public findSourceByKey(string $key): EventSource
$key string
return EventSource
throws InvalidArgumentException if there's no source with the key

getEventQueries

Returns a new query for the events of each source (or the given sources), keyed by source, with the source's custom query params, the date criteria and the extra query params applied.

public getEventQueries(mixed $date = null, ?array $extraQueryParams = null, string[]|null $sourceKeys = null, User|null $user = null): array<string,ElementQuery>
$date mixed
$extraQueryParams ?array
$sourceKeys string[]|null
$user User|null only query events the user can access
return array<string,ElementQuery>

getEvents

Returns the events of each source (or the given sources), keyed by source.

public getEvents(mixed $date = null, ?array $extraQueryParams = null, string[]|null $sourceKeys = null, User|null $user = null): array<string,ElementInterface[]>
$date mixed
$extraQueryParams ?array
$sourceKeys string[]|null
$user User|null only return events the user can access
return array<string,ElementInterface[]>

getOrganizers

Returns the users listed in the organizer filter on the control panel calendar.

public getOrganizers(): User[]
return User[]

updateICalendarSequence

Increments the iCalendar sequence of an event.

Events don't get a metadata row until they're first changed, and a missing row means sequence 0, so the row is created with sequence 1.

public updateICalendarSequence(int $elementId): void
$elementId int

getICalendarSequence

Returns the iCalendar sequence of an event.

For an event hard-deleted in the current request, returns its last sequence.

public getICalendarSequence(int $elementId): int
$elementId int
return int