Yoast\WP\SEO\Generators

Schema_Generator::get_type_from_piece()privateYoast 1.0

Retrieves the type from a graph piece.

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

Хуков нет.

Возвращает

Массив. An array of the piece's types.

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

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

Код Schema_Generator::get_type_from_piece() Yoast 22.4

private function get_type_from_piece( $piece ) {
	if ( isset( $piece['@type'] ) ) {
		if ( \is_array( $piece['@type'] ) ) {
			// Return as-is, but remove unusable values, like sub-arrays, objects, null.
			return \array_filter( $piece['@type'], 'is_string' );
		}

		return [ $piece['@type'] ];
	}

	return [];
}