WPCF7_Editor::displaypublicCF7 1.0

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

Хуков нет.

Возвращает

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

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

$WPCF7_Editor = new WPCF7_Editor();
$WPCF7_Editor->display();

Код WPCF7_Editor::display() CF7 6.1.7

public function display() {
	if ( empty( $this->panels ) ) {
		return;
	}

	$active_panel_id = wpcf7_superglobal_get( 'active-tab' );

	if ( ! array_key_exists( $active_panel_id, $this->panels ) ) {
		$active_panel_id = array_key_first( $this->panels );
	}

	$formatter = new WPCF7_HTMLFormatter();

	$formatter->append_start_tag( 'nav', array(
		'id' => 'contact-form-editor-tabs',
		'role' => 'tablist',
		'aria-label' => __( 'Contact form editor tabs', 'contact-form-7' ),
		'data-active-tab' => absint( array_search(
			$active_panel_id, array_keys( $this->panels ), true
		) ),
	) );

	foreach ( $this->panels as $panel_id => $panel ) {
		$active = $panel_id === $active_panel_id;

		$formatter->append_start_tag( 'button', array(
			'type' => 'button',
			'role' => 'tab',
			'aria-selected' => $active ? 'true' : 'false',
			'aria-controls' => $panel_id,
			'id' => sprintf( '%s-tab', $panel_id ),
			'tabindex' => $active ? '0' : '-1',
		) );

		$formatter->append_preformatted( esc_html( $panel['title'] ) );
	}

	$formatter->end_tag( 'nav' );

	foreach ( $this->panels as $panel_id => $panel ) {
		$active = $panel_id === $active_panel_id;

		$formatter->append_start_tag( 'section', array(
			'role' => 'tabpanel',
			'aria-labelledby' => sprintf( '%s-tab', $panel_id ),
			'id' => $panel_id,
			'class' => 'contact-form-editor-panel',
			'tabindex' => '0',
			'hidden' => ! $active,
		) );

		if ( is_callable( $panel['callback'] ) ) {
			$formatter->call_user_func( $panel['callback'], $this->contact_form );
		}

		$formatter->end_tag( 'section' );
	}

	$formatter->print();
}