public function CssW3Form::submitCheckDirectory in Advanced CSS/JS Aggregation 8.3
Same name and namespace in other branches
- 8.4 advagg_validator/src/Form/CssW3Form.php \Drupal\advagg_validator\Form\CssW3Form::submitCheckDirectory()
- 8.2 advagg_validator/src/Form/CssW3Form.php \Drupal\advagg_validator\Form\CssW3Form::submitCheckDirectory()
File
- advagg_validator/
src/ Form/ CssW3Form.php, line 125
Class
- CssW3Form
- Configure form for W3C validation of CSS files.
Namespace
Drupal\advagg_validator\FormCode
public function submitCheckDirectory(array &$form, FormStateInterface $form_state) {
$dir = $form_state
->getTriggeringElement()['#name'];
$files = [];
$slash_count = substr_count('/' . $dir, '/');
foreach ($form_state
->getValues() as $key => $value) {
if (strpos($key, 'hidden') === FALSE || strpos($value, $dir) === FALSE || substr_count($value, '/') > $slash_count || $dir === '.' && substr_count($value, '/') > 0) {
continue;
}
$files[] = $value;
}
// Check list.
$info = $this
->testFiles($files);
$info = $this
->hideGoodFiles($info);
$output = [
'#theme' => 'item_list',
'#items' => $info,
];
$this
->messenger()
->addMessage($this->renderer
->render($output));
}