public static function AdminHookHandler::hookAdminSettingsValidate in DB Maintenance 7.2
Validation for the administrative settings form.
Parameters
object $form: An associative array containing the structure of the form.
object $form_state: A keyed array containing the current state of the form.
1 call to AdminHookHandler::hookAdminSettingsValidate()
- db_maintenance_admin_settings_validate in ./
db_maintenance.admin.inc - Validation for the administrative settings form.
File
- src/
Module/ Hook/ AdminHookHandler.php, line 152 - AdminHookHandler class.
Class
- AdminHookHandler
- AdminHookHandler class.
Namespace
Drupal\db_maintenance\Module\HookCode
public static function hookAdminSettingsValidate($form, &$form_state) {
// Check time interval.
if ($form_state['values']['db_maintenance_use_time_interval'] == 1) {
// Check start value.
$time = $form_state['values']['db_maintenance_time_interval_start'];
if (!IntervalHandler::checkTime($time)) {
form_set_error('db_maintenance_time_interval_start', t('Invalid time format. Should be 24 hour format H:i (HH:MM) like 23:30 or 01:00.'));
}
// Check end value.
$time = $form_state['values']['db_maintenance_time_interval_end'];
if (!IntervalHandler::checkTime($time)) {
form_set_error('db_maintenance_time_interval_end', t('Invalid time format. Should be 24 hour format H:i (HH:MM) like 23:30 or 01:00.'));
}
}
}