WPCF7_HTMLFormatter::format()publicCF7 1.0

Outputs formatted HTML based on the given chunks.

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

Хуков нет.

Возвращает

Строку. Formatted HTML.

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

$WPCF7_HTMLFormatter = new WPCF7_HTMLFormatter();
$WPCF7_HTMLFormatter->format( $chunks );
$chunks(iterable) (обязательный)
The original chunks.

Код WPCF7_HTMLFormatter::format() CF7 5.7.3

public function format( $chunks ) {
	$chunks = $this->pre_format( $chunks );
	$chunks = $this->concatenate_texts( $chunks );

	$this->output = '';
	$this->stacked_elements = array();

	foreach ( $chunks as $chunk ) {

		if ( $chunk['type'] === self::text ) {
			$this->append_text( $chunk['content'] );
		}

		if ( $chunk['type'] === self::start_tag ) {
			$this->start_tag( $chunk['content'] );
		}

		if ( $chunk['type'] === self::end_tag ) {
			$this->end_tag( $chunk['content'] );
		}

		if ( $chunk['type'] === self::comment ) {
			$this->append_comment( $chunk['content'] );
		}
	}

	// Close all remaining tags.
	$this->close_all_tags();

	return $this->output;
}