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

wpcf7_constant_contact_setup_property() CF7 1.0

Sets up the constant_contact property value. For back-compat, this attempts to take over the value from old settings if the property is empty.

Хуков нет.

Возвращает

null. Ничего.

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

wpcf7_constant_contact_setup_property( $property, $contact_form );
$property (обязательный)
-
$contact_form (обязательный)
-

Код wpcf7_constant_contact_setup_property() CF7 5.5.3

function wpcf7_constant_contact_setup_property( $property, $contact_form ) {
	if ( ! empty( $property ) ) {
		$property = wp_parse_args(
			$property,
			array(
				'enable_contact_list' => false,
				'contact_lists' => array(),
			)
		);

		return $property;
	}

	$property = array(
		'enable_contact_list' => true,
		'contact_lists' => array(),
	);

	if ( $contact_form->initial() ) {
		return $property;
	}

	$service_option = (array) WPCF7::get_option( 'constant_contact' );

	$additional_settings = $contact_form->additional_setting(
		'constant_contact',
		false
	);

	$property['enable_contact_list'] = ! array_filter(
		$additional_settings,
		function ( $setting ) {
			return in_array( $setting, array( 'off', 'false', '0' ), true );
		}
	);

	if ( isset( $service_option['contact_lists'] ) ) {
		$contact_lists = (array) $service_option['contact_lists'];
		$contact_lists_selected = array();

		foreach ( $contact_lists as $list ) {
			if ( empty( $list['selected'] ) ) {
				continue;
			}

			foreach ( (array) $list['selected'] as $key => $val ) {
				if ( ! isset( $contact_lists_selected[$key] ) ) {
					$contact_lists_selected[$key] = array();
				}

				$contact_lists_selected[$key][] = $list['list_id'];
			}
		}

		$related_keys = array(
			sprintf( 'wpcf7_contact_form:%d', $contact_form->id() ),
			'default',
		);

		foreach ( $related_keys as $key ) {
			if ( ! empty( $contact_lists_selected[$key] ) ) {
				$property['contact_lists'] = $contact_lists_selected[$key];
				break;
			}
		}
	}

	return $property;
}