wpcf7_sendinblue_editor_templates() │ CF7 1.0

Хуков нет.

Возвращает

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

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

wpcf7_sendinblue_editor_templates( $template_selected, $options );
$template_selected(обязательный)
.
$options
.
По умолчанию: ''

Код wpcf7_sendinblue_editor_templates() CF7 6.2.4.1

function wpcf7_sendinblue_editor_templates( $template_selected, $options = '' ) {
	$options = wp_parse_args( $options, array(
		'clear_cache' => false,
		'run_query' => true,
	) );

	$formatter = new WPCF7_HTMLFormatter();

	$formatter->append_start_tag( 'fieldset' );

	$templates = wpcf7_sendinblue_get_templates( $options );

	if ( ! isset( $templates ) ) {
		$formatter->append_start_tag( 'legend' );

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

		$formatter->end_tag( 'legend' );

		$formatter->append_start_tag( 'input', array(
			'type' => 'hidden',
			'name' => 'wpcf7-sendinblue[email_template]',
			'value' => $template_selected,
		) );

	} elseif ( $templates ) {
		$formatter->append_start_tag( 'legend' );

		$formatter->append_preformatted(
			esc_html( __( 'Select an email template:', 'contact-form-7' ) )
		);

		$formatter->end_tag( 'legend' );

		$formatter->append_start_tag( 'select', array(
			'name' => 'wpcf7-sendinblue[email_template]',
		) );

		$formatter->append_start_tag( 'option', array(
			'value' => 0,
			'selected' => 0 === $template_selected,
		) );

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

		$formatter->end_tag( 'option' );

		foreach ( $templates as $template ) {
			$formatter->append_start_tag( 'option', array(
				'value' => $template['id'],
				'selected' => $template_selected === $template['id'],
			) );

			$formatter->append_preformatted( esc_html( $template['name'] ) );

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

		$formatter->end_tag( 'select' );

	} else {
		$formatter->append_start_tag( 'legend' );

		$formatter->append_preformatted(
			esc_html( __( 'You have no active email template yet.', 'contact-form-7' ) )
		);

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

	$formatter->end_tag( 'fieldset' );

	$formatter->append_start_tag( 'p' );

	$formatter->append_start_tag( 'a', array(
		'href' => 'https://my.sendinblue.com/camp/lists/template',
	) );

	$formatter->append_preformatted(
		esc_html( __( 'Manage your email templates', 'contact-form-7' ) )
	);

	$formatter->end_tag( 'p' );

	$formatter->print();
}