Tribe__Repository::apply_modifier( string $key, mixed $value = null )

Applies and returns a schema entry.


Parameters

$key

(string) (Required)

$value

(mixed) (Optional)

Default value: null

$args

(mixed) (Required) Additional arguments for the application.


Top ↑

Return

(mixed) A scalar value or a callable.


Top ↑

Source

File: src/Tribe/Repository.php

	public function apply_modifier( $key, $value ) {
		$call_args = func_get_args();

		$application = Tribe__Utils__Array::get( $this->schema, $key, null );

		/**
		 * Return primitives, including `null`, as they are.
		 */
		if ( ! is_callable( $application ) ) {
			return $application;
		}

		/**
		 * Allow for callbacks to fire immediately and return more complex values.
		 * This also means that callbacks meant to run on the next step, the one
		 * where args are applied, will need to be "wrapped" in callbacks themselves.
		 * The `$key` is removed from the args to get the value first and avoid
		 * unused args.
		 */
		$args_without_key = array_splice( $call_args, 1 );

		return call_user_func_array( $application, $args_without_key );
	}

Top ↑

Changelog

Changelog
Version Description
4.7.19 Introduced.