Yoast\WP\SEO\Schema_Aggregator\Application\Filtering

Default_Filter::should_keep_pieceprivateYoast 1.0

Determines if a schema piece should be kept based on all its types.

A piece is kept if at least one of its types should be kept.

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

Хуков нет.

Возвращает

true|false. Whether to keep the schema piece.

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

// private - только в коде основоного (родительского) класса
$result = $this->should_keep_piece( $types, $elements_context_map, $schema, $schema_piece ): bool;
$types(array) (обязательный)
The types to check.
$elements_context_map(массив) (обязательный)
.
$schema(Schema_Piece_Collection) (обязательный)
The full schema collection.
$schema_piece(Schema_Piece) (обязательный)
The schema piece being checked.

Код Default_Filter::should_keep_piece() Yoast 27.7

private function should_keep_piece(
	array $types,
	array $elements_context_map,
	Schema_Piece_Collection $schema,
	Schema_Piece $schema_piece
): bool {
	foreach ( $types as $type ) {
		if ( $this->should_keep_type( $type, $elements_context_map, $schema, $schema_piece ) ) {
			return true;
		}
	}

	return false;
}