Commit b2b42c8e authored by droces's avatar droces

Added validation for bookable unit id in BookingSettingsForm

parent b2c9c4a0
......@@ -116,6 +116,14 @@ class BookingSettingsForm extends ConfigFormBase {
public function validateForm(array &$form, FormStateInterface $form_state) {
parent::validateForm($form, $form_state);
// Validate site bookable unit
$bookable_nid = $form_state->getValue('bookable');
$bookable = node_load($bookable_nid);
if (! $bookable) {
$form_state->setErrorByName('bookable',
$this->t("No bookable unit was found with that ID.", array('%address' => $address)));
}
// Validate notification email addresses
$recipients_string = $form_state->getValue('notifn_emails_addresses');
......@@ -128,7 +136,7 @@ class BookingSettingsForm extends ConfigFormBase {
}
// Validate backend URL
$backend_url = $form_state->getValue('backend_url');
if ($backend_url && UrlHelper::isValid($backend_url) === FALSE) {
// $urlValidator = new UrlValidator();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment