WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Самая быстрая Тема-конструктор для WordPress
функция не описана

WPCF7_ConfigValidator::detect_multiple_controls_in_label() public CF7 1.0

{} Это метод класса: WPCF7_ConfigValidator{}

Хуков нет.

Возвращает

Null. Ничего.

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

$WPCF7_ConfigValidator = new WPCF7_ConfigValidator();
$WPCF7_ConfigValidator->detect_multiple_controls_in_label( $section, $content );

Код WPCF7_ConfigValidator::detect_multiple_controls_in_label() CF7 5.3

<?php
public function detect_multiple_controls_in_label( $section, $content ) {
	$pattern = '%<label(?:[ \t\n]+.*?)?>(.+?)</label>%s';

	if ( preg_match_all( $pattern, $content, $matches ) ) {
		$form_tags_manager = WPCF7_FormTagsManager::get_instance();

		foreach ( $matches[1] as $insidelabel ) {
			$tags = $form_tags_manager->scan( $insidelabel );
			$fields_count = 0;

			foreach ( $tags as $tag ) {
				$is_multiple_controls_container = wpcf7_form_tag_supports(
					$tag->type, 'multiple-controls-container' );
				$is_zero_controls_container = wpcf7_form_tag_supports(
					$tag->type, 'zero-controls-container' );

				if ( $is_multiple_controls_container ) {
					$fields_count += count( $tag->values );

					if ( $tag->has_option( 'free_text' ) ) {
						$fields_count += 1;
					}
				} elseif ( $is_zero_controls_container ) {
					$fields_count += 0;
				} elseif ( ! empty( $tag->name ) ) {
					$fields_count += 1;
				}

				if ( 1 < $fields_count ) {
					return $this->add_error( $section,
						self::error_multiple_controls_in_label, array(
							'link' => self::get_doc_link( 'multiple_controls_in_label' ),
						)
					);
				}
			}
		}
	}

	return false;
}