Yoast\WP\SEO\Presenters
Breadcrumbs_Presenter::should_link_target_blank
This is needed because when the editor is loaded in an Iframe the link needs to open in a different browser window. We don't want this behaviour in the front-end and the way to check this is to check if the block is rendered in a REST request with the context set as 'edit'. Thus being in the editor.
Метод класса: Breadcrumbs_Presenter{}
Хуков нет.
Возвращает
true|false. returns if the breadcrumb should be opened in another window.
Использование
// private - только в коде основоного (родительского) класса $result = $this->should_link_target_blank(): bool;
Код Breadcrumbs_Presenter::should_link_target_blank() Breadcrumbs Presenter::should link target blank Yoast 27.4
private function should_link_target_blank(): bool {
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.
if ( isset( $_GET['context'] ) && \is_string( $_GET['context'] ) ) {
// phpcs:ignore WordPress.Security.NonceVerification.Recommended,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: We are not processing form information, We are only strictly comparing.
if ( \wp_unslash( $_GET['context'] ) === 'edit' ) {
return true;
}
}
return false;
}