Form::get_fields_errors( false|array $fields = false )
Description #
Get errors of all fields.
Parameters #
- $fieldsfalse | array (Optional) Fields. Default value: false
Source #
File: lib/class-form.php
public function get_fields_errors( $fields = false ) { $errors = array(); if ( false === $this->prepared ) { $this->prepare(); } if ( false === $fields ) { $fields = $this->fields; } foreach ( (array) $fields as $field ) { if ( $field->have_errors() ) { $errors[ $field->id() ] = array( 'error' => $field->errors ); } if ( ! empty( $field->child ) && ! empty( $field->child->fields ) ) { $child_errors = $this->get_fields_errors( $field->child->fields ); if ( ! empty( $child_errors ) ) { $errors[ $field->id() ]['child'] = $child_errors; } } } return $errors; }
Expand full source code Collapse full source code View on GitHub: lib/class-form.php:441
Add your comment