Yoast\WP\SEO\Builders

Indexable_Hierarchy_Builder::save_ancestors()privateYoast 1.0

Saves the ancestors.

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

Хуков нет.

Возвращает

null. Ничего (null).

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

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

Код Indexable_Hierarchy_Builder::save_ancestors() Yoast 22.4

private function save_ancestors( $indexable ) {
	if ( empty( $indexable->ancestors ) ) {
		$this->indexable_hierarchy_repository->add_ancestor( $indexable->id, 0, 0 );
		return;
	}
	$depth = \count( $indexable->ancestors );
	foreach ( $indexable->ancestors as $ancestor ) {
		$this->indexable_hierarchy_repository->add_ancestor( $indexable->id, $ancestor->id, $depth );
		--$depth;
	}
}