protected function StaticUITrait::getWarnings in Tome 8
Collects warnings to help users correct issues in rendered HTML.
Return value
array An array of warning messages to display to the user.
2 calls to StaticUITrait::getWarnings()
- StaticCommand::execute in modules/
tome_static/ src/ Commands/ StaticCommand.php - StaticGeneratorForm::buildForm in modules/
tome_static/ src/ Form/ StaticGeneratorForm.php - Form constructor.
File
- modules/
tome_static/ src/ StaticUITrait.php, line 18
Class
- StaticUITrait
- Trait containing methods useful for different static user interfaces.
Namespace
Drupal\tome_staticCode
protected function getWarnings() {
$warnings = [];
$performance_config = \Drupal::config('system.performance');
if (!$performance_config
->get('css.preprocess') || !$performance_config
->get('js.preprocess')) {
if (!$performance_config
->get('css.preprocess') && !$performance_config
->get('js.preprocess')) {
$message = $this
->t('CSS and JS preprocessing is disabled.');
}
elseif (!$performance_config
->get('css.preprocess')) {
$message = $this
->t('CSS preprocessing is disabled.');
}
else {
$message = $this
->t('JS preprocessing is disabled.');
}
$warnings[] = $message . ' ' . $this
->t('This could lead to performance issues. To resolve, visit /admin/config/development/performance.');
}
$twig_config = \Drupal::getContainer()
->getParameter('twig.config');
if ($twig_config['debug'] || !$twig_config['cache']) {
if ($twig_config['debug'] && !$twig_config['cache']) {
$message = $this
->t('Twig debugging is enabled and caching is disabled.');
}
elseif ($twig_config['debug']) {
$message = $this
->t('Twig debugging is enabled.');
}
else {
$message = $this
->t('Twig caching is disabled.');
}
$warnings[] = $message . ' ' . $this
->t('This could lead to performance issues. To resolve, edit the "twig.config" parameter in the "sites/*/services.yml" file, then rebuild cache.');
}
return $warnings;
}