WPCF7_FormTag::get_class_option()publicCF7 1.0

Retrieves the class option value from the form-tag.

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

Хуков нет.

Возвращает

Строку|true|false. A whitespace-separated list of classes. False if there is no class to return.

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

$WPCF7_FormTag = new WPCF7_FormTag();
$WPCF7_FormTag->get_class_option( $default_classes );
$default_classes(строка|массив)
Preset classes as an array or a whitespace-separated list.
По умолчанию: empty string

Код WPCF7_FormTag::get_class_option() CF7 5.9.3

public function get_class_option( $default_classes = '' ) {
	if ( is_string( $default_classes ) ) {
		$default_classes = explode( ' ', $default_classes );
	}

	$options = array_merge(
		(array) $default_classes,
		(array) $this->get_option( 'class' )
	);

	$options = array_map( 'sanitize_html_class', $options );
	$options = array_filter( array_unique( $options ) );

	if ( empty( $options ) ) {
		return false;
	}

	return implode( ' ', $options );
}