Automattic\WooCommerce\Internal\StockNotifications\Frontend

MyAccountEndpoint::get_action_url │ public static │ WC 1.0

Build the nonce-protected URL a row action link points at.

Same shape as the other My Account action links (cancel order, resend set-password): a GET back to the endpoint carrying the action, the id, and a scoped nonce.

Метод класса: MyAccountEndpoint{}

Хуков нет.

Возвращает

string. The action URL.

Использование

$result = MyAccountEndpoint::get_action_url( $action, $notification_id, $page ): string;
$action(строка) (обязательный)
One of the ACTION_* values.
$notification_id(int) (обязательный)
The notification id.
$page(int)
1-indexed page the link is rendered on.
По умолчанию: 1

Код MyAccountEndpoint::get_action_url() WC 11.2.2

public static function get_action_url( string $action, int $notification_id, int $page = 1 ): string {
	$args = array(
		self::ACTION_FIELD => $action,
		'notification_id'  => $notification_id,
	);

	// Carried so the redirect afterwards returns the customer to the page they acted from.
	if ( $page > 1 ) {
		$args['notifications_page'] = $page;
	}

	$url = add_query_arg( $args, self::get_endpoint_url() );

	return wp_nonce_url( $url, self::get_nonce_action( $action, $notification_id ) );
}