Sample::get_template_variables()


Source

File: src/Tickets_Wallet_Plus/Passes/Pdf/Sample.php

	public function get_template_variables(): array {
		$pdf_settings = [
			'header_image_url'       => tribe( Settings\Header_Image_Setting::class )->get_attachment_path(),
			'header_image_alignment' => tribe( Settings\Image_Alignment_Setting::class )->get_value(),
			'header_bg_color'        => tribe( Settings\Header_Color_Setting::class )->get_value(),
			'additional_info'        => wpautop( tribe( Settings\Additional_Content_Setting::class )->get_value() ),
			'qr_enabled'             => tribe( QR_Settings::class )->is_enabled() && tribe( Settings\Qr_Codes_Setting::class )->get_value(),
			'include_credit'         => tribe( Settings\Include_Credit_Setting::class )->get_value(),
		];

		// Get some info from Tickets Emails Preview data.
		$attendees = tribe( Preview_Data::class )->get_attendees();
		$post      = tribe( Preview_Data::class )->get_post();

		$attendees[0]['holder_name'] = empty( $attendees[0]['post_title'] ) ? $attendees[0]['holder_name'] : $attendees[0]['post_title'];

		$context = array_merge(
			$pdf_settings,
			[
				'attendee'       => $attendees[0],
				'post'           => $post,
				'post_image_url' => tribe( Plugin::class )->plugin_path . 'src/resources/images/post-example-image.jpg',
				'qr_image_url'   => tribe( Plugin::class )->plugin_path . 'src/resources/images/example-qr.png',
			]
		);

		/**
		 * Filter the template context for the PDF sample pass.
		 *
		 * @since 1.0.0
		 *
		 * @param array $context The template context.
		 *
		 * @return array The modified template context.
		 */
		return apply_filters( 'tec_tickets_wallet_plus_pdf_sample_template_context', $context );
	}