-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathform-handling.php
29 lines (24 loc) · 981 Bytes
/
form-handling.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
include 'forms/form--add-type.php';
include 'forms/form--delete-type.php';
include 'forms/form--add-data.php';
include 'forms/form--delete-data.php';
include 'forms/form--settings.php';
function bp_validate_form_input( $post_data = [] ) {
if ( ! isset( $post_data[ 'bp_date' ] ) || empty( $post_data[ 'bp_date' ] ) ) {
return [
'code' => 'error_no_date',
'message' => esc_html__( 'No date selected.', 'b3-assets-tracker' ),
];
}
if ( ! empty( $post_data[ 'bp_date' ] ) ) {
$date_exists = bp_date_exists( $post_data[ 'bp_date' ] );
if ( true === $date_exists ) {
return [
'code' => 'error_date_exists',
'message' => esc_html__( 'This date already exists, please edit the existing date.', 'b3-assets-tracker' ),
];
}
}
return true;
}