You are here

public function StaticGenerator::getPaths in Tome 8

Gets all uncached public-facing paths for the site.

Entity paths will be returned in the format "_entity:entity_type_id:langcode:entity_id" and should be resolved by the caller using a batch process.

Return value

string[] An array of paths.

Overrides StaticGeneratorInterface::getPaths

File

modules/tome_static/src/StaticGenerator.php, line 115

Class

StaticGenerator
Handles static site generation.

Namespace

Drupal\tome_static

Code

public function getPaths() {
  $this->accountSwitcher
    ->switchTo(new AnonymousUserSession());
  $event = new CollectPathsEvent([]);
  $this->eventDispatcher
    ->dispatch(TomeStaticEvents::COLLECT_PATHS, $event);
  $paths = $event
    ->getPaths();
  $paths = $this->cache
    ->filterUncachedPaths($this->currentRequest
    ->getSchemeAndHttpHost(), $paths);
  $this->accountSwitcher
    ->switchBack();
  return array_values($paths);
}