Automattic\WooCommerce\Internal\StockNotifications\Emails

CustomerStockNotificationVerifyEmail::get_additional_template_argsprivateWC 1.0

Get template args.

Method of the class: CustomerStockNotificationVerifyEmail{}

Returns

Array.

Usage

// private - for code of main (parent) class only
$result = $this->get_additional_template_args(): array;

CustomerStockNotificationVerifyEmail::get_additional_template_args() code WC 10.3.6

private function get_additional_template_args(): array {

	$notification = $this->object;
	$product      = $notification->get_product();

	/**
	 * Filter the button text.
	 *
	 * @since 10.2.0
	 *
	 * @param string $button_text The button text.
	 * @param Notification $notification The notification object.
	 * @param WC_Product $product The product object.
	 */
	$verification_button_text  = apply_filters(
		'woocommerce_email_stock_notification_verify_button_text',
		_x( 'Confirm', 'Stock Notification confirm notification', 'woocommerce' ),
		$notification,
		$product
	);
	$verification_key          = $notification->get_verification_key( true );
	$expiration_threshold      = Config::get_verification_expiration_time_threshold();
	$expiration_threshold_text = sprintf(
		/* translators: %s is the time duration in minutes */
		_n( '%s minute', '%s minutes', $expiration_threshold / 60, 'woocommerce' ),
		floor( $expiration_threshold / 60 )
	);

	return array(
		'verification_button_text'          => $verification_button_text,
		'verification_expiration_threshold' => $expiration_threshold_text,
		'verification_link'                 => add_query_arg(
			array(
				'email_link_action_key' => $verification_key,
				'notification_id'       => $notification->get_id(),
			),
			get_option( 'siteurl' )
		),
	);
}