WPCF7_TagGenerator::print_panelspublicCF7 1.0

Renders form-tag generator dialog panels (hidden until called).

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

Хуков нет.

Возвращает

null. Ничего (null).

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

$WPCF7_TagGenerator = new WPCF7_TagGenerator();
$WPCF7_TagGenerator->print_panels( $contact_form );
$contact_form(WPCF7_ContactForm) (обязательный)
.

Код WPCF7_TagGenerator::print_panels() CF7 6.1.6

public function print_panels( WPCF7_ContactForm $contact_form ) {
	$formatter = new WPCF7_HTMLFormatter( array(
		'allowed_html' => array_merge( wpcf7_kses_allowed_html(), array(
			'dialog' => array(
				'id' => true,
				'class' => true,
			),
			'form' => array(
				'method' => true,
				'class' => true,
				'data-*' => true,
			),
		) ),
	) );

	foreach ( (array) $this->panels as $id => $panel ) {
		$callback = $panel['callback'];

		$options = array_merge( $panel['options'], array(
			'id' => $id,
			'title' => $panel['title'],
			'content' => $panel['content'],
		) );

		if ( is_callable( $callback ) ) {
			$formatter->append_start_tag( 'dialog', array(
				'id' => $options['content'],
				'class' => 'tag-generator-dialog',
			) );

			$formatter->append_start_tag( 'button', array(
				'class' => 'close-button',
				'title' => __( 'Close this dialog box', 'contact-form-7' ),
				'data-taggen' => 'close-dialog',
			) );

			$formatter->append_preformatted(
				esc_html( __( 'Close', 'contact-form-7' ) )
			);

			$formatter->end_tag( 'button' );

			$formatter->append_start_tag( 'form', array(
				'method' => 'dialog',
				'class' => 'tag-generator-panel',
				'data-id' => $options['id'],
				'data-version' => $options['version'],
			) );

			$formatter->call_user_func( $callback, $contact_form, $options );

			$formatter->close_all_tags();
		}
	}

	$formatter->print();
}