Hooks

Class Hooks.


Source

File: src/Events_Virtual/Integrations/Plugins/Event_Tickets/Emails/Hooks.php

class Hooks extends Service_Provider {

	/**
	 * Binds and sets up implementations.
	 *
	 * @since 1.15.0
	 */
	public function register(): void {
		$this->add_actions();
	}

	/**
	 * Adds the actions required by each Tickets Emails component.
	 *
	 * @since 1.15.0
	 */
	protected function add_actions(): void {
		add_action( 'tribe_template_before_include:tickets/emails/template-parts/header/head/styles', [ $this, 'include_virtual_event_styles' ], 10, 3 );
		add_action( 'tribe_template_after_include:tickets/emails/template-parts/body/tickets', [ $this, 'include_virtual_event_link' ], 9, 3 );
	}

	/**
	 * Include the Virtual Event link in the ticket and RSVP emails.
	 *
	 * @since 1.15.0
	 *
	 * @param string          $file     Template file.
	 * @param string          $name     Template name.
	 * @param Common_Template $template Event Tickets template object.
	 *
	 * @return void
	 */
	public function include_virtual_event_link( $file, $name, $template ) {
		if ( ! $template instanceof Common_Template ) {
			return;
		}

		$this->container->make( RSVP::class )->include_virtual_event_link( $template );
		$this->container->make( Ticket::class )->include_virtual_event_link( $template );
	}

	/**
	 * Include the Virtual Event link styles in the ticket and RSVP emails.
	 *
	 * @since 1.15.0
	 *
	 * @param string          $file     Template file.
	 * @param string          $name     Template name.
	 * @param Common_Template $template Event Tickets template object.
	 *
	 * @return void
	 */
	public function include_virtual_event_styles( $file, $name, $template ) {
		if ( ! $template instanceof Common_Template ) {
			return;
		}

		$this->container->make( RSVP::class )->include_virtual_event_link_styles( $template );
		$this->container->make( Ticket::class )->include_virtual_event_link_styles( $template );
	}

}

Top ↑

Changelog

Changelog
Version Description
1.15.0 Introduced.

Top ↑

Methods