Yoast\WP\SEO\Schema_Aggregator\Domain

External_Schema_Piece_Repository_Interface{}interfaceYoast 1.0

Interface for external schema piece repositories.

Implementations provide schema pieces from external sources (e.g., WooCommerce, EDD).

Хуков нет.

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

$External_Schema_Piece_Repository_Interface = new External_Schema_Piece_Repository_Interface();
// use class methods

Методы

  1. public collect( int $post_id )
  2. public supports( string $post_type )

Код External_Schema_Piece_Repository_Interface{} Yoast 27.7

interface External_Schema_Piece_Repository_Interface {

	/**
	 * Checks if this repository supports the given post type.
	 *
	 * @param string $post_type The post type to check.
	 *
	 * @return bool True if this repository can provide schema for the post type.
	 */
	public function supports( string $post_type ): bool;

	/**
	 * Collects external schema pieces for the given post.
	 *
	 * @param int $post_id The post ID.
	 *
	 * @return array<array<string,string|int|bool|array>> The schema pieces (always an array, may be empty).
	 */
	public function collect( int $post_id ): array;
}