Yoast\WP\SEO\Schema_Aggregator\Infrastructure\Schema_Pieces

Schema_Piece_Repository::collect_external_schemaprivateYoast 1.0

Collects external schema pieces from all supporting repositories.

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

Хуков нет.

Возвращает

Массив<Массив<Строку,Строку|int|true|false|Массив>>. The schema pieces with external pieces added.

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

// private - только в коде основоного (родительского) класса
$result = $this->collect_external_schema( $pieces_data, $post_type, $post_id ): array;
$pieces_data(array<array<string,string|int|true|false|array>>) (обязательный)
The existing schema pieces.
$post_type(строка) (обязательный)
The post type.
$post_id(int) (обязательный)
The post ID.

Код Schema_Piece_Repository::collect_external_schema() Yoast 28.3

private function collect_external_schema( array $pieces_data, string $post_type, int $post_id ): array {
	foreach ( $this->external_repositories as $repository ) {
		if ( $repository->supports( $post_type ) ) {
			$external_pieces = $repository->collect( $post_id );
			$pieces_data     = \array_merge( $pieces_data, $external_pieces );
		}
	}

	return $pieces_data;
}