Yoast\WP\SEO\MyYoast_Client\User_Interface

Myyoast_Connection_Data_Presenter::presentpublicYoast 1.0

Returns the connection payload, or null when the feature flag is disabled.

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

Хуков нет.

Возвращает

array{isProvisioned: bool, canConnect: bool, connectUrl: string|null, learnMoreUrl: string}|null.

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

$Myyoast_Connection_Data_Presenter = new Myyoast_Connection_Data_Presenter();
$Myyoast_Connection_Data_Presenter->present();

Код Myyoast_Connection_Data_Presenter::present() Yoast 28.4

public function present() {
	if ( ! $this->myyoast_connection_conditional->is_met() ) {
		return null;
	}

	$status      = $this->status_presenter->present();
	$can_connect = $this->connection_permission->can_manage();

	return [
		'isProvisioned' => \is_bool( $status['is_provisioned'] ) && $status['is_provisioned'],
		'canConnect'    => $can_connect,
		// Only users who can manage options can start the flow; for everyone
		// else the link is omitted and the editor shows the "ask your admin" variant.
		'connectUrl'    => ( $can_connect ) ? $this->get_connect_url() : null,
		'learnMoreUrl'  => $this->short_link_helper->get( 'https://yoa.st/ai-myyoast-connection' ),
	];
}