tribe_callback( string $slug, string $method )

Returns a lambda function suitable to use as a callback; when called the function will build the implementation bound to $classOrInterface and return the value of a call to $method method with the call arguments.


Parameters

$slug

(string) (Required) A class or interface fully qualified name or a string slug.

$method

(string) (Required) The method that should be called on the resolved implementation with the specified array arguments.

(mixed) (Required) [$argsN] (optional) Any number of arguments that will be passed down to the Callback


Top ↑

Return

(callable) A PHP Callable based on the Slug and Methods passed


Top ↑

Source

File: src/Tribe/Container.php

		function tribe_callback( $slug, $method ) {
			$container = Tribe__Container::init();
			$arguments = func_get_args();
			$is_empty = 2 === count( $arguments );

			if ( $is_empty ) {
				$callable = $container->callback( $slug, $method );
			} else {
				$callback = $container->callback( 'callback', 'get' );
				$callable = call_user_func_array( $callback, $arguments );
			}

			return $callable;
		}

Top ↑

Changelog

Changelog
Version Description
4.7
4.6.2 Introduced.