tribe( string|null $slug_or_class = null )

Returns a ready to use instance of the requested class.

Example use:

 tribe_singleton( 'common.main', 'Tribe__Main');

 // some code later...

 tribe( 'common.main' )->do_something();

Parameters

$slug_or_class

(string|null) (Optional) Either the slug of a binding previously registered using tribe_singleton or tribe_register or the full class name that should be automagically created or null to get the container instance itself.

Default value: null


Top ↑

Return

(mixed|object|Tribe__Container) The instance of the requested class. Please note that the cardinality of the class is controlled registering it as a singleton using tribe_singleton or tribe_register; if the $slug_or_class parameter is null then the container itself will be returned.


Top ↑

Source

File: src/Tribe/Container.php

	function tribe( $slug_or_class = null ) {
		$container = Tribe__Container::init();

		return null === $slug_or_class ? $container : $container->make( $slug_or_class );
	}