Yoast\WP\SEO\AI\Content_Planner\Infrastructure\Recent_Content

Recent_Content_Collector::map_to_post_listprivateYoast 1.0

Maps indexable results to a Post_List.

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

Хуков нет.

Возвращает

Post_List. The mapped post list.

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

// private - только в коде основоного (родительского) класса
$result = $this->map_to_post_list( $indexables ): Post_List;
$indexables(Indexable[]) (обязательный)
The indexable results.

Код Recent_Content_Collector::map_to_post_list() Yoast 27.8

private function map_to_post_list( array $indexables ): Post_List {
	$post_list = new Post_List();

	foreach ( $indexables as $indexable ) {
		$post_list->add(
			new Post(
				( $indexable->breadcrumb_title ?? '' ),
				( $indexable->description ?? '' ),
				$this->get_primary_category( $indexable->object_id ?? 0 ),
				( $indexable->primary_focus_keyword ?? '' ),
				( $indexable->is_cornerstone ?? false ),
				( $indexable->object_last_modified ?? '' ),
				( \in_array( $indexable->schema_article_type, self::VALID_SCHEMA_TYPES, true ) ? $indexable->schema_article_type : null ),
			),
		);
	}

	return $post_list;
}