You are here

public function LanguageAccessSubscriber::pathIsWhitelisted in Language access 8

Checks if the path is whitelisted.

Parameters

string $request_url: The request URL.

Return value

bool TRUE when the user can access the given URL.

1 call to LanguageAccessSubscriber::pathIsWhitelisted()
LanguageAccessSubscriber::customLanguageAccess in src/EventSubscriber/LanguageAccessSubscriber.php
Redirect pattern based url.

File

src/EventSubscriber/LanguageAccessSubscriber.php, line 103

Class

LanguageAccessSubscriber
Redirect .html pages to corresponding Node page.

Namespace

Drupal\language_access\EventSubscriber

Code

public function pathIsWhitelisted(string $request_url) : bool {
  $allowed_urls = [
    '/user/',
    PublicStream::basePath(),
    'sitemap.xml',
  ];
  foreach ($allowed_urls as $allowed_url) {
    if (strpos($request_url, $allowed_url) !== FALSE) {
      return FALSE;
    }
  }
  return TRUE;
}