Automattic\WooCommerce\Internal\ProductFeed\Mapping

UcpProductMapper::build_description │ private │ WC 1.0

Build the description object, preferring the short description.

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

Хуков нет.

Возвращает

array.

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

// private - только в коде основоного (родительского) класса
$result = $this->build_description( $item ): array;
$item(массив) (обязательный)
Store API item response.

Код UcpProductMapper::build_description() WC 11.3.0

private function build_description( array $item ): array {
	$html = trim( (string) $item['short_description'] );
	if ( '' === $html ) {
		$html = trim( (string) $item['description'] );
	}

	// Entities would reach the agent literally, so decode after stripping tags.
	$plain = html_entity_decode( wp_strip_all_tags( $html ), ENT_QUOTES, get_bloginfo( 'charset' ) );

	// Decoded ` ` is U+00A0. Agents match on this text, so normalize it to a
	// plain space rather than leaving a character that breaks string comparison.
	$plain = str_replace( "\xc2\xa0", ' ', $plain );

	$description = array( 'plain' => trim( $plain ) );

	if ( '' !== $html ) {
		$description['html'] = $html;
	}

	return $description;
}