Yoast\WP\SEO\Schema_Aggregator\Application\Filtering

Default_Filter::filterpublicYoast 1.0

Applies filtering to the given schema.

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

Хуков нет.

Возвращает

Schema_Piece_Collection. The filtered schema.

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

$Default_Filter = new Default_Filter();
$Default_Filter->filter( $schema ): Schema_Piece_Collection;
$schema(Schema_Piece_Collection) (обязательный)
The schema to be filtered.

Код Default_Filter::filter() Yoast 27.7

public function filter( Schema_Piece_Collection $schema ): Schema_Piece_Collection {
	$filtered_schema      = [];
	$elements_context_map = $this->elements_context_map_repository->get_map();

	foreach ( $schema->to_array() as $schema_piece ) {
		$piece_types = (array) $schema_piece->get_type();

		if ( ! $this->should_keep_piece( $piece_types, $elements_context_map, $schema, $schema_piece ) ) {
			continue;
		}

		$filtered_schema[] = $this->apply_property_filters( $schema_piece, $piece_types );
	}

	return new Schema_Piece_Collection( $filtered_schema );
}