Automattic\WooCommerce\Internal\Admin\Settings
Utils::get_wpcom_connection_authorization
Get the details to authorize a connection to WordPress.com.
The most important part of the result is the URL to redirect to for authorization.
Метод класса: Utils{}
Хуков нет.
Возвращает
Массив. 'success' => bool Whether the request was successful. 'errors' => array An array of error messages, if any. 'color_scheme' => string The color scheme to use for the authorization page. 'url' => string The URL to redirect to for authorization.
Использование
$result = Utils::get_wpcom_connection_authorization( $return_url ): array;
- $return_url(строка) (обязательный)
- The URL to redirect to after the connection is authorized.
Код Utils::get_wpcom_connection_authorization() Utils::get wpcom connection authorization WC 11.0.1
public static function get_wpcom_connection_authorization( string $return_url ): array {
$result = JetpackConnection::get_authorization_url( $return_url );
if ( ! empty( $result['url'] ) ) {
$result['url'] = add_query_arg(
array(
// We use the new WooDNA value.
'from' => 'woocommerce-onboarding',
// We inform Calypso that this is a WooPayments onboarding flow.
'plugin_name' => 'woocommerce-payments',
// Use the current user's WP admin color scheme.
'color_scheme' => $result['color_scheme'],
),
$result['url']
);
}
return $result;
}