Controller::factory( array $options = array(), string $template = '' )

Summary

Creates an instance of the controller


Parameters

$options

(array) (Optional)

Default value: array()

$template

(string) (Optional)

Default value: ''


Return

(static)


Source

File: src/BigCommerce/Templates/Controller.php

	public static function factory( array $options = [], $template = '' ) {
		/**
		 * Filter the factory class that instantiates template controllers
		 *
		 * @param Controller_Factory $factory   The instance of the factory class
		 * @param string             $classname The name of the requested class
		 */
		$factory = apply_filters( 'bigcommerce/template/controller_factory', new Controller_Factory(), static::class );
		if ( ! $factory instanceof Controller_Factory ) {
			throw new \RuntimeException( sprintf( __( 'Template controller factory must extend %s', 'bigcommerce' ), Controller_Factory::class ) );
		}

		return $factory->get_controller( static::class, $options, $template );
	}


User Contributed Notes

You must log in before being able to contribute a note or feedback.