Tribe__Tickets__Tickets::get_ticket_provider_instance( self|string $provider )

Given a provider string (class module name or slug), get its class instance if an active module.


Parameters #

$provider

(self|string) (Required) Examples: 'Tribe__Tickets_Plus__Commerce__WooCommerce__Main', 'woo', 'rsvp', etc.


Top ↑

Return #

(self|false) Instance of child class (if confirmed active) or False if provider is not active.


Top ↑

Source #

File: src/Tribe/Tickets.php

		public static function get_ticket_provider_instance( $provider ) {
			$is_provider_active = tribe_tickets_is_provider_active( $provider );

			if ( empty( $is_provider_active ) ) {
				return false;
			}

			if ( $provider instanceof self ) {
				return $provider;
			}

			/** @var Tribe__Tickets__Status__Manager $status */
			$status = tribe( 'tickets.status' );

			$provider = $status->get_provider_class_from_slug( $provider );

			$instance = tribe_get_class_instance( $provider );

			if ( ! $instance instanceof self ) {
				return false;
			}

			return $instance;
		}