WC_Product_Variable_Data_Store_CPT::validate_children_data()
Validate the children data by checking the structure and type of the data.
Метод класса: WC_Product_Variable_Data_Store_CPT{}
Хуков нет.
Возвращает
true|false
. True if valid, false otherwise.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->validate_children_data( $children, $current_version );
- $children(массив) (обязательный)
- The children data.
- $current_version(строка) (обязательный)
- The current transient version.
Код WC_Product_Variable_Data_Store_CPT::validate_children_data() WC Product Variable Data Store CPT::validate children data WC 9.8.1
protected function validate_children_data( $children, $current_version ) { if ( ! is_array( $children ) ) { return false; } // Basic structure checks. if ( empty( $children['all'] ) || ! isset( $children['visible'] ) ) { return false; } // Version check - only if version is set. if ( isset( $children['version'] ) && $children['version'] !== $current_version ) { return false; } if ( ! is_array( $children['all'] ) || ! is_array( $children['visible'] ) ) { return false; } foreach ( $children['all'] as $id ) { if ( ! is_numeric( $id ) ) { return false; } } foreach ( $children['visible'] as $id ) { if ( ! is_numeric( $id ) ) { return false; } } return true; }