Yoast\WP\SEO\MyYoast_Client\User_Interface
Integrations_Page_Script_Data::error_message_key
Maps a failed callback outcome to the front-end message key.
Translates the neutral, native-OAuth outcome into the message keys the integrations-page JS understands (see messageFor() in myyoast-integration.js). The same missing code means different things per OAuth phase: a provider error other than access_denied is unexpected, while a token-endpoint error other than invalid_grant is a generic token failure.
Метод класса: Integrations_Page_Script_Data{}
Хуков нет.
Возвращает
Строку. The message key the front-end maps to copy.
Использование
// private - только в коде основоного (родительского) класса $result = $this->error_message_key( $outcome ): string;
- $outcome(Callback_Outcome) (обязательный)
- The failed callback outcome.
Код Integrations_Page_Script_Data::error_message_key() Integrations Page Script Data::error message key Yoast 28.3
private function error_message_key( Callback_Outcome $outcome ): string {
if ( $outcome->get_error_phase() === Callback_Outcome::PHASE_PROVIDER ) {
return ( $outcome->get_error_code() === 'access_denied' ) ? 'connection_cancelled' : 'unexpected_error';
}
if ( $outcome->get_error_code() === 'invalid_grant' ) {
return 'token_request_failed_invalid_grant';
}
if ( $outcome->get_error_code() === null ) {
return 'unexpected_error';
}
return 'token_request_failed';
}