Submission_Edit_Page::validate_custom_data( array $form_data, awsmug\Torro_Forms\DB_Objects\Submissions\WP_Error $error )

Validates custom model data that is not handled by the field manager.

Description

This method is called from within the ‘edit’ action.

See also

Parameters

$form_data

(array) (Required) Form POST data.

$error

(awsmug\Torro_Forms\DB_Objects\Submissions\WP_Error) (Required) Error object to add errors to.

Source

File: src/db-objects/submissions/submission-edit-page.php

	protected function validate_custom_data( $form_data, $error ) {
		parent::validate_custom_data( $form_data, $error );

		if ( isset( $form_data['status'] ) && $form_data['status'] !== $this->model->status ) {
			if ( ! in_array( $form_data['status'], array( 'completed', 'progressing' ), true ) ) {
				$error->add( 'action_edit_item_invalid_status', $this->model_manager->get_message( 'action_edit_item_invalid_status' ) );
			} else {
				$this->model->status = $form_data['status'];
			}
		}
	}

Changelog

Changelog
Version Description
1.0.0 Introduced.