wpcf7_constant_contact_setup_property()
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
. Ничего (null).
Использование
wpcf7_constant_contact_setup_property( $property, $contact_form );
- $property (обязательный)
- -
- $contact_form (обязательный)
- -
Код wpcf7_constant_contact_setup_property() wpcf7 constant contact setup property CF7 5.9.8
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' ); $property['enable_contact_list'] = ! $contact_form->is_false( 'constant_contact' ); 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; }