You are here

protected function CriticalCssProvider::sanitizePath in Critical CSS 8

Sanitizes a path so its usable as a filename.

Return value

string The sanitized path.

1 call to CriticalCssProvider::sanitizePath()
CriticalCssProvider::calculateFilePaths in src/Asset/CriticalCssProvider.php
Get all possible paths to search, relatives to theme.

File

src/Asset/CriticalCssProvider.php, line 336

Class

CriticalCssProvider
Critical CSS Provider.

Namespace

Drupal\critical_css\Asset

Code

protected function sanitizePath($path) {
  $path = preg_replace("/^\\//", "", $path);
  $path = preg_replace("/[^a-zA-Z0-9\\/-]/", "", $path);
  $path = str_replace("/", "-", $path);
  if (empty($path)) {
    $path = 'front';
  }
  return $path;
}