Same name in other branches
  1. 5.0.x advagg_validator/src/Form/JsHintForm.php \Drupal\advagg_validator\Form\JsHintForm
  2. 6.0.x advagg_validator/src/Form/JsHintForm.php \Drupal\advagg_validator\Form\JsHintForm
  3. 8.x-3.x advagg_validator/src/Form/JsHintForm.php \Drupal\advagg_validator\Form\JsHintForm
  4. 8.x-4.x advagg_validator/src/Form/JsHintForm.php \Drupal\advagg_validator\Form\JsHintForm

Configure form for JsHint validation of JavaScript files.

Hierarchy

  • class \Drupal\advagg\Form\AdvaggFormBase extends \Drupal\Core\Form\ConfigFormBase
    • class \Drupal\advagg_validator\Form\BaseValidatorForm extends \Drupal\advagg\Form\AdvaggFormBase
      • class \Drupal\advagg_validator\Form\JsHintForm extends \Drupal\advagg_validator\Form\BaseValidatorForm

Expanded class hierarchy of JsHintForm

1 string reference to 'JsHintForm'
advagg_validator.routing.yml in advagg_validator/advagg_validator.routing.yml
advagg_validator/advagg_validator.routing.yml

File

advagg_validator/src/Form/JsHintForm.php, line 10

Namespace

Drupal\advagg_validator\Form
View source
class JsHintForm extends BaseValidatorForm {
    
    /**
     * {@inheritdoc}
     */
    public function getFormId() {
        return 'advagg_validator_jshint';
    }
    
    /**
     * {@inheritdoc}
     */
    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;
    }

}

Members

Title Sort descending Modifiers Object type Summary Overrides
AdvaggFormBase::$advaggAggregates protected property The AdvAgg aggregates state information storage service.
AdvaggFormBase::$advaggFiles protected property The AdvAgg file status state information storage service.
AdvaggFormBase::$requestStack protected property The request stack.
AdvaggFormBase::create public static function 1
AdvaggFormBase::isAjax protected function Checks if the form was submitted by AJAX.
AdvaggFormBase::__construct public function Constructs a SettingsForm object. 1
BaseValidatorForm::domExtractor protected function Extract info from the DOMNode Object.
BaseValidatorForm::generateForm public function Generate a heirachical form sorted by path from asset files.
BaseValidatorForm::getEditableConfigNames protected function
BaseValidatorForm::getElement protected function Get array element that corresponds to directory.
BaseValidatorForm::hideGoodFiles protected function Do not display info on a file if it is valid.
BaseValidatorForm::scanAllDirs protected function Recursively scan the drupal webroot for files matching the given extension.
BaseValidatorForm::scanDirectory protected function Finds all files that match a given mask in a given directory.
BaseValidatorForm::testFiles protected function Perform server side test(s) on all given files. 1
JsHintForm::buildForm public function
JsHintForm::getFormId public function