Hooks

Class Hooks.


Source

File: src/Tickets/Commerce/Gateways/Free/Hooks.php

class Hooks extends Service_Provider {

	/**
	 * Binds and sets up implementations.
	 *
	 * @since 5.10.0
	 */
	public function register() {
		$this->add_filters();
	}

	/**
	 * Adds the filters required by each Tickets Commerce component.
	 *
	 * @since 5.10.0
	 */
	protected function add_filters() {
		add_filter( 'tec_tickets_commerce_gateways', [ $this, 'filter_add_gateway' ], 10, 2 );
		add_action( 'rest_api_init', [ $this, 'register_endpoints' ] );
	}

	/**
	 * Add this gateway to the list of available.
	 *
	 * @since 5.10.0
	 *
	 * @param array $gateways List of available gateways.
	 *
	 * @return array
	 */
	public function filter_add_gateway( array $gateways = [] ) {
		return $this->container->make( Gateway::class )->register_gateway( $gateways );
	}

	/**
	 * Register the REST API endpoints.
	 *
	 * @since 5.10.0
	 */
	public function register_endpoints() {
		$this->container->make( REST\Order_Endpoint::class )->register();
	}
}

Top ↑

Changelog

Changelog
Version Description
5.10.0 Introduced.

Top ↑

Methods