You are here

interface StaticGeneratorInterface in Tome 8

Provides an interface for the static generator.

Hierarchy

Expanded class hierarchy of StaticGeneratorInterface

All classes that implement StaticGeneratorInterface

8 files declare their use of StaticGeneratorInterface
StaticCommand.php in modules/tome_static/src/Commands/StaticCommand.php
StaticDownloadController.php in modules/tome_static/src/Controller/StaticDownloadController.php
StaticExportPathCommand.php in modules/tome_static/src/Commands/StaticExportPathCommand.php
StaticGeneratorForm.php in modules/tome_static/src/Form/StaticGeneratorForm.php
StaticPreviewCommand.php in modules/tome_static/src/Commands/StaticPreviewCommand.php

... See full list

File

modules/tome_static/src/StaticGeneratorInterface.php, line 8

Namespace

Drupal\tome_static
View source
interface StaticGeneratorInterface {

  /**
   * The key user interfaces should use to get/set if they're running a build.
   */
  const STATE_KEY_BUILDING = 'tome_static.building';

  /**
   * The latest build URL in order to make it easier the next time.
   */
  const STATE_KEY_URL = 'tome_static.url';

  /**
   * The request attribute key used to flag requests coming from the build.
   */
  const REQUEST_KEY = '_tome_static_request';

  /**
   * 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 string[]
   *   An array of paths.
   */
  public function getPaths();

  /**
   * Requests and exports a given path.
   *
   * This method should only be called for paths that need a Drupal bootstrap.
   *
   * Note that calling this method multiple times in one bootstrap may have
   * result in improper renders - it's recommended that this is called once
   * per request.
   *
   * @param string $path
   *   A path to export, or an entity to load and export in the format
   *   "_entity:entity_type_id:langcode:entity_id".
   *
   * @return string[]
   *   An array of paths that should be passed to ::exportPaths.
   */
  public function requestPath($path);

  /**
   * Exports multiple paths.
   *
   * If a path is a file that already exists, it will be immediately copied. If
   * a path needs to be fetched in a new request, it will be returned.
   *
   * @param string[] $paths
   *   An array of paths to export.
   *
   * @return string[]
   *   An array of paths that need to be fetched in new requests. Usually these
   *   are image style derivatives.
   */
  public function exportPaths(array $paths);

  /**
   * Cleans up old files from the static directory.
   */
  public function cleanupStaticDirectory();

  /**
   * Gets the static directory.
   *
   * @return string
   *   The static directory.
   */
  public function getStaticDirectory();

  /**
   * Prepares the static directory for a fresh export.
   *
   * @return bool
   *   TRUE on success, FALSE on failure.
   */
  public function prepareStaticDirectory();

}

Members

Namesort descending Modifiers Type Description Overrides
StaticGeneratorInterface::cleanupStaticDirectory public function Cleans up old files from the static directory. 1
StaticGeneratorInterface::exportPaths public function Exports multiple paths. 1
StaticGeneratorInterface::getPaths public function Gets all uncached public-facing paths for the site. 1
StaticGeneratorInterface::getStaticDirectory public function Gets the static directory. 1
StaticGeneratorInterface::prepareStaticDirectory public function Prepares the static directory for a fresh export. 1
StaticGeneratorInterface::requestPath public function Requests and exports a given path. 1
StaticGeneratorInterface::REQUEST_KEY constant The request attribute key used to flag requests coming from the build.
StaticGeneratorInterface::STATE_KEY_BUILDING constant The key user interfaces should use to get/set if they're running a build.
StaticGeneratorInterface::STATE_KEY_URL constant The latest build URL in order to make it easier the next time.