Yoast\WP\SEO\Schema_Aggregator\Application\Filtering

Default_Filter::apply_property_filtersprivateYoast 1.0

Applies property filters for all types of a schema piece.

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

Хуков нет.

Возвращает

Schema_Piece. The filtered schema piece.

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

// private - только в коде основоного (родительского) класса
$result = $this->apply_property_filters( $schema_piece, $types ): Schema_Piece;
$schema_piece(Schema_Piece) (обязательный)
The schema piece to filter.
$types(array) (обязательный)
The types of the schema piece.

Код Default_Filter::apply_property_filters() Yoast 27.7

private function apply_property_filters( Schema_Piece $schema_piece, array $types ): Schema_Piece {
	$filtered_piece   = $schema_piece;
	$filter_was_found = false;

	foreach ( $types as $type ) {
		$filter = $this->get_property_filter( $type );
		if ( $filter !== null ) {
			$filtered_piece   = $filter->filter_properties( $filtered_piece );
			$filter_was_found = true;
		}
	}

	if ( ! $filter_was_found ) {
		return ( new Base_Schema_Node_Property_Filter() )->filter_properties( $schema_piece );
	}

	return $filtered_piece;
}