wpcf7_tag_generator_text()
Хуков нет.
Возвращает
null. Ничего (null).
Использование
wpcf7_tag_generator_text( $contact_form, $options );
- $contact_form(обязательный)
- .
- $options(обязательный)
- .
Код wpcf7_tag_generator_text() wpcf7 tag generator text CF7 6.1.6
function wpcf7_tag_generator_text( $contact_form, $options ) {
$field_types = array(
'text' => array(
'display_name' => __( 'Text field', 'contact-form-7' ),
'heading' => __( 'Text field form-tag generator', 'contact-form-7' ),
'description' => __( 'Generates a form-tag for a <a href="https://contactform7.com/text-fields/">single-line plain text input field</a>.', 'contact-form-7' ),
'maybe_purpose' => 'author_name',
),
'email' => array(
'display_name' => __( 'Email address field', 'contact-form-7' ),
'heading' => __( 'Email address field form-tag generator', 'contact-form-7' ),
'description' => __( 'Generates a form-tag for an <a href="https://contactform7.com/text-fields/">email address input field</a>.', 'contact-form-7' ),
'maybe_purpose' => 'author_email',
),
'url' => array(
'display_name' => __( 'URL field', 'contact-form-7' ),
'heading' => __( 'URL field form-tag generator', 'contact-form-7' ),
'description' => __( 'Generates a form-tag for a <a href="https://contactform7.com/text-fields/">URL input field</a>.', 'contact-form-7' ),
'maybe_purpose' => 'author_url',
),
'tel' => array(
'display_name' => __( 'Telephone number field', 'contact-form-7' ),
'heading' => __( 'Telephone number field form-tag generator', 'contact-form-7' ),
'description' => __( 'Generates a form-tag for a <a href="https://contactform7.com/text-fields/">telephone number input field</a>.', 'contact-form-7' ),
'maybe_purpose' => 'author_tel',
),
);
$basetype = $options['id'];
if ( ! in_array( $basetype, array_keys( $field_types ), true ) ) {
$basetype = 'text';
}
$tgg = new WPCF7_TagGeneratorGenerator( $options['content'] );
$formatter = new WPCF7_HTMLFormatter();
$formatter->append_start_tag( 'header', array(
'class' => 'description-box',
) );
$formatter->append_start_tag( 'h3' );
$formatter->append_preformatted(
esc_html( $field_types[$basetype]['heading'] )
);
$formatter->end_tag( 'h3' );
$formatter->append_start_tag( 'p' );
$formatter->append_preformatted(
wp_kses_data( $field_types[$basetype]['description'] )
);
$formatter->end_tag( 'header' );
$formatter->append_start_tag( 'div', array(
'class' => 'control-box',
) );
$formatter->call_user_func( static function () use ( $tgg, $field_types, $basetype ) {
$tgg->print( 'field_type', array(
'with_required' => true,
'select_options' => array(
$basetype => $field_types[$basetype]['display_name'],
),
) );
$tgg->print( 'field_name', array(
'ask_if' => $field_types[$basetype]['maybe_purpose']
) );
$tgg->print( 'class_attr' );
$tgg->print( 'min_max', array(
'title' => __( 'Length', 'contact-form-7' ),
'min_option' => 'minlength:',
'max_option' => 'maxlength:',
) );
$tgg->print( 'default_value', array(
'with_placeholder' => true,
) );
} );
$formatter->end_tag( 'div' );
$formatter->append_start_tag( 'footer', array(
'class' => 'insert-box',
) );
$formatter->call_user_func( static function () use ( $tgg, $field_types ) {
$tgg->print( 'insert_box_content' );
$tgg->print( 'mail_tag_tip' );
} );
$formatter->print();
}