public function W3cValidatorSettingsForm::buildForm in W3C Validator 8
Form constructor.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form structure.
Overrides ConfigFormBase::buildForm
File
- src/
Form/ W3cValidatorSettingsForm.php, line 68
Class
- W3cValidatorSettingsForm
- Configuration settings page for W3C Validator page.
Namespace
Drupal\w3c_validator\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$form = parent::buildForm($form, $form_state);
$form['w3c_validator'] = [
'#markup' => $this
->t('This module uses the official W3c Validator scripts. We strongly recommand to install the official w3c validator on your own server and provide the url here? You can also use the official online w3c validator service.') . '<br />' . $this
->t('For instructions on how to install an instance of the w3c validator scripts you have instructions at <a href="http://validator.w3.org/docs/install.html">http://validator.w3.org/docs/install.html</a>.') . '<br />' . $this
->t('Debian based distributions comes with a package called <em>w3c_markup_validator</em> which provides a ready to use install of the validator.') . '<br />' . $this
->t('Using the official W3C validator endpoint url for high volume of validations could be considered abuse of service.'),
];
$form['validator_url'] = [
'#type' => 'url',
'#title' => t('W3C Validator API endpoint URI'),
'#description' => t('URL of the validator script where API call will be targeted.') . '<br/>' . $this
->t('You can use the official service at @w3cvalidator althought its not recommended.', [
'@w3cvalidator' => Link::fromTextAndUrl('http://validator.w3.org/check', Url::fromUri('http://validator.w3.org/check'))
->toString(),
]) . '<br/>' . $this
->t('Leave empty to use the default installed validator path: @validator.', [
'@validator' => Link::fromTextAndUrl(Validator::DEFAULT_VALIDATOR_URL, Url::fromUri(Validator::DEFAULT_VALIDATOR_URL))
->toString(),
]),
'#default_value' => $this->w3cProcessor
->getValidatorUrl(),
];
return $form;
}