WPCF7_HTMLFormatter::concatenate_texts()
Concatenates neighboring text chunks to create a single chunk.
Метод класса: WPCF7_HTMLFormatter{}
Хуков нет.
Возвращает
iterable
. Processed chunks.
Использование
$WPCF7_HTMLFormatter = new WPCF7_HTMLFormatter(); $WPCF7_HTMLFormatter->concatenate_texts( $chunks );
- $chunks(iterable) (обязательный)
- The original chunks.
Код WPCF7_HTMLFormatter::concatenate_texts() WPCF7 HTMLFormatter::concatenate texts CF7 6.0.5
public function concatenate_texts( $chunks ) { $position = 0; $text_left = null; foreach ( $chunks as $chunk ) { $chunk['position'] = $position; if ( self::text === $chunk['type'] ) { if ( isset( $text_left ) ) { $text_left['content'] .= $chunk['content']; } else { $text_left = $chunk; } continue; } if ( isset( $text_left ) ) { yield $text_left; $chunk['position'] = self::calc_next_position( $text_left ); $text_left = null; } yield $chunk; $position = self::calc_next_position( $chunk ); } if ( isset( $text_left ) ) { yield $text_left; } }