public function ReportUri::validateForm in Content-Security-Policy 8
Validate the form fields of this report handler.
Parameters
array $form: The form fields for this plugin.
\Drupal\Core\Form\FormStateInterface $form_state: The submitted form state.
Overrides ReportingHandlerBase::validateForm
File
- src/
Plugin/ CspReportingHandler/ ReportUri.php, line 64
Class
- ReportUri
- CSP Reporting Plugin for ReportURI service.
Namespace
Drupal\csp\Plugin\CspReportingHandlerCode
public function validateForm(array &$form, FormStateInterface $form_state) {
$subdomain = $form_state
->getValue($form['subdomain']['#parents']);
// Custom domains must be 4-30 characters, but generated domains are 32.
if (!preg_match('/^[a-z\\d]{4,32}$/i', $subdomain)) {
$form_state
->setError($form['subdomain'], 'Must be 4-30 alphanumeric characters.');
}
}