public function JsHintForm::buildForm in Advanced CSS/JS Aggregation 8.3
Same name and namespace in other branches
- 8.4 advagg_validator/src/Form/JsHintForm.php \Drupal\advagg_validator\Form\JsHintForm::buildForm()
- 8.2 advagg_validator/src/Form/JsHintForm.php \Drupal\advagg_validator\Form\JsHintForm::buildForm()
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
- advagg_validator/
src/ Form/ JsHintForm.php, line 22
Class
- JsHintForm
- Configure form for JsHint validation of JavaScript files.
Namespace
Drupal\advagg_validator\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$form = parent::generateForm('js');
$form['#attached']['library'][] = 'advagg_validator/jshint';
$ignore_list = $this
->config('advagg_validator.settings')
->get('jshint_ignore');
if (is_array($ignore_list)) {
$ignore_list = implode(',', $ignore_list);
}
$form['#attached']['drupalSettings']['jshint'] = [
'browser' => TRUE,
'curly' => TRUE,
'eqeqeq' => TRUE,
'forin' => TRUE,
'latedef' => TRUE,
'newcap' => TRUE,
'noarg' => TRUE,
'strict' => TRUE,
'trailing' => TRUE,
'undef' => TRUE,
'unused' => TRUE,
'predef' => [
'Drupal' => FALSE,
'drupalSettings' => FALSE,
'domready' => FALSE,
'jQuery' => FALSE,
'_' => FALSE,
'matchMedia' => FALSE,
'Backbone' => FALSE,
'Modernizr' => FALSE,
'VIE' => FALSE,
'CKEDITOR' => FALSE,
],
'ignore' => $ignore_list,
];
$form = parent::buildForm($form, $form_state);
unset($form['actions']);
return $form;
}