WPCF7_TagGeneratorGenerator::selectable_values()privateCF7 1.0

Template method for selectable values useful for checkboxes or a menu.

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

Хуков нет.

Возвращает

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

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

// private - только в коде основоного (родительского) класса
$result = $this->selectable_values( $options );
$options **
-
По умолчанию: ''

Код WPCF7_TagGeneratorGenerator::selectable_values() CF7 6.0.1

<?php
private function selectable_values( $options = '' ) {
	$options = wp_parse_args( $options, array(
		'first_as_label' => false,
		'use_label_element' => false,
	) );

?>
<fieldset>
<legend id="<?php echo esc_attr( $this->ref( 'selectable-values-legend' ) ); ?>"><?php
	echo esc_html( __( 'Selectable values', 'contact-form-7' ) );
?></legend>
<?php
	echo sprintf(
		'<span %1$s>%2$s</span>',
		wpcf7_format_atts( array(
			'id' => $this->ref( 'selectable-values-description' ),
		) ),
		esc_html( __( "One item per line.", 'contact-form-7' ) )
	);
?>
<br />
<?php
	echo sprintf(
		'<textarea %1$s>%2$s</textarea>',
		wpcf7_format_atts( array(
			'required' => true,
			'data-tag-part' => 'value',
			'aria-labelledby' => $this->ref( 'selectable-values-legend' ),
			'aria-describedby' => $this->ref( 'selectable-values-description' ),
		) ),
		esc_html( __( "Option 1\nOption 2\nOption 3", 'contact-form-7' ) )
	);
?>

<?php if ( $options['first_as_label'] ) { ?>
<br />
<?php
	echo sprintf(
		'<label><input %1$s /> %2$s</label>',
		wpcf7_format_atts( array(
			'type' => 'checkbox',
			'checked' => 'checked' === $options['first_as_label'],
			'data-tag-part' => 'option',
			'data-tag-option' => 'first_as_label',
		) ),
		esc_html( __( "Use the first item as a label.", 'contact-form-7' ) )
	);
?>
<?php } ?>

<?php if ( $options['use_label_element'] ) { ?>
<br />
<?php
	echo sprintf(
		'<label><input %1$s /> %2$s</label>',
		wpcf7_format_atts( array(
			'type' => 'checkbox',
			'checked' => 'checked' === $options['use_label_element'],
			'data-tag-part' => 'option',
			'data-tag-option' => 'use_label_element',
		) ),
		esc_html( __( "Wrap each item with a label element.", 'contact-form-7' ) )
	);
?>
<?php } ?>

</fieldset>
<?php
}