public function Uri::getForm in Content-Security-Policy 8
Get the form fields for configuring this reporting handler.
Parameters
array $form: The plugin parent form element.
Return value
array A Form array.
Overrides ReportingHandlerBase::getForm
File
- src/
Plugin/ CspReportingHandler/ Uri.php, line 27
Class
- Uri
- CSP Reporting Plugin for a URI endpoint.
Namespace
Drupal\csp\Plugin\CspReportingHandlerCode
public function getForm(array $form) {
$form['uri'] = [
'#type' => 'textfield',
'#title' => $this
->t('URI'),
'#description' => $this
->t('The URI to send reports to.'),
'#default_value' => isset($this->configuration['uri']) ? $this->configuration['uri'] : '',
'#states' => [
'required' => [
':input[name="' . $this->configuration['type'] . '[enable]"]' => [
'checked' => TRUE,
],
':input[name="' . $this->configuration['type'] . '[reporting][handler]"]' => [
'value' => $this->pluginId,
],
],
],
];
unset($form['#description']);
return $form;
}