wpcf7_form_controls_class()CF7 1.0

Returns a class names list for a form-tag of the specified type.

Хуков нет.

Возвращает

Строку. Whitespace-separated list of class names.

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

wpcf7_form_controls_class( $type, $default_classes );
$type(строка) (обязательный)
Form-tag type.
$default_classes(строка)
Optional default classes.
По умолчанию: ''

Код wpcf7_form_controls_class() CF7 5.6.3

function wpcf7_form_controls_class( $type, $default_classes = '' ) {
	$type = trim( $type );
	$default_classes = array_filter( explode( ' ', $default_classes ) );

	$classes = array_merge( array( 'wpcf7-form-control' ), $default_classes );

	$typebase = rtrim( $type, '*' );
	$required = ( '*' == substr( $type, -1 ) );

	$classes[] = 'wpcf7-' . $typebase;

	if ( $required ) {
		$classes[] = 'wpcf7-validates-as-required';
	}

	$classes = array_unique( $classes );

	return implode( ' ', $classes );
}