PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / trunk
Yoast SEO – Advanced SEO with real-time guidance and built-in AI vtrunk
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
← All changes | src/integrations/blocks/breadcrumbs-block.php +7 -16 18.5 → trunk View file →
@@ -2,9 +2,8 @@
2 2
3 3 namespace Yoast\WP\SEO\Integrations\Blocks;
4 4
5 5 use WPSEO_Replace_Vars;
6 -use Yoast\WP\SEO\Helpers\Request_Helper;
7 6 use Yoast\WP\SEO\Memoizers\Meta_Tags_Context_Memoizer;
8 7 use Yoast\WP\SEO\Presenters\Breadcrumbs_Presenter;
9 8 use Yoast\WP\SEO\Repositories\Indexable_Repository;
10 9 use Yoast\WP\SEO\Surfaces\Helpers_Surface;
@@ -11,9 +10,9 @@
11 10
12 11 /**
13 12 * Siblings block class
14 13 */
15 -class Breadcrumbs_Block extends Dynamic_Block {
14 +class Breadcrumbs_Block extends Dynamic_Block_V3 {
16 15
17 16 /**
18 17 * The name of the block.
19 18 *
@@ -56,15 +55,8 @@
56 55 */
57 56 private $indexable_repository;
58 57
59 58 /**
60 - * The request helper.
61 - *
62 - * @var Request_Helper
63 - */
64 - private $request_helper;
65 -
66 - /**
67 59 * Siblings_Block constructor.
68 60 *
69 61 * @param Meta_Tags_Context_Memoizer $context_memoizer The context.
70 62 * @param WPSEO_Replace_Vars $replace_vars The replace variable helper.
@@ -69,28 +61,27 @@
69 61 * @param Meta_Tags_Context_Memoizer $context_memoizer The context.
70 62 * @param WPSEO_Replace_Vars $replace_vars The replace variable helper.
71 63 * @param Helpers_Surface $helpers The Helpers surface.
72 64 * @param Indexable_Repository $indexable_repository The indexable repository.
73 - * @param Request_Helper $request_helper The request helper.
74 65 */
75 66 public function __construct(
76 67 Meta_Tags_Context_Memoizer $context_memoizer,
77 68 WPSEO_Replace_Vars $replace_vars,
78 69 Helpers_Surface $helpers,
79 - Indexable_Repository $indexable_repository,
80 - Request_Helper $request_helper
70 + Indexable_Repository $indexable_repository
81 71 ) {
82 72 $this->context_memoizer = $context_memoizer;
83 73 $this->replace_vars = $replace_vars;
84 74 $this->helpers = $helpers;
85 75 $this->indexable_repository = $indexable_repository;
86 - $this->request_helper = $request_helper;
76 +
77 + $this->base_path = \WPSEO_PATH . 'blocks/dynamic-blocks/';
87 78 }
88 79
89 80 /**
90 81 * Presents the breadcrumbs output for the current page or the available post_id.
91 82 *
92 - * @param array $attributes The block attributes.
83 + * @param array<string, bool|string|int|array> $attributes The block attributes.
93 84 *
94 85 * @return string The block output.
95 86 */
96 87 public function present( $attributes ) {
@@ -96,9 +87,9 @@
96 87 public function present( $attributes ) {
97 88 $presenter = new Breadcrumbs_Presenter();
98 89 // $this->context_memoizer->for_current_page only works on the frontend. To render the right breadcrumb in the
99 90 // editor, we need the repository.
100 - if ( $this->request_helper->is_rest_request() || \is_admin() ) {
91 + if ( \wp_is_serving_rest_request() || \is_admin() ) {
101 92 $post_id = \get_the_ID();
102 93 if ( $post_id ) {
103 94 $indexable = $this->indexable_repository->find_by_id_and_type( $post_id, 'post' );
104 95
@@ -108,9 +99,9 @@
108 99 [
109 100 'object_id' => $post_id,
110 101 'object_type' => 'post',
111 102 'object_sub_type' => $post->post_type,
112 - ]
103 + ],
113 104 );
114 105 }
115 106
116 107 $context = $this->context_memoizer->get( $indexable, 'Post_Type' );