CssLintForm.php in Advanced CSS/JS Aggregation 8.2
File
advagg_validator/src/Form/CssLintForm.php
View source
<?php
namespace Drupal\advagg_validator\Form;
use Drupal\Core\Form\FormStateInterface;
class CssLintForm extends BaseValidatorForm {
public function getFormId() {
return 'advagg_validator_csslint';
}
public function buildForm(array $form, FormStateInterface $form_state) {
$form = parent::generateForm('css');
if (file_exists(DRUPAL_ROOT . '/.csslintrc')) {
$json_string = file_get_contents(DRUPAL_ROOT . '/.csslintrc');
if (!empty($json_string)) {
$json_data = json_decode($json_string, TRUE);
}
}
$form['#attached']['library'][] = 'advagg_validator/csslint';
if (!empty($json_data)) {
$form['#attached']['drupalSettings']['csslint'] = [
'rules' => $json_data,
];
}
$form = parent::buildForm($form, $form_state);
unset($form['actions']);
return $form;
}
}
Classes
Name |
Description |
CssLintForm |
Configure form for CSSHint validation of CSS files. |