You are here

interface MinisiteInterface in Mini site 8

Interface MinisiteInterface.

@package Drupal\minisite

Hierarchy

Expanded class hierarchy of MinisiteInterface

All classes that implement MinisiteInterface

2 files declare their use of MinisiteInterface
MinisiteItem.php in src/Plugin/Field/FieldType/MinisiteItem.php
MinisiteWidget.php in src/Plugin/Field/FieldWidget/MinisiteWidget.php

File

src/MinisiteInterface.php, line 13

Namespace

Drupal\minisite
View source
interface MinisiteInterface {

  /**
   * Directory to upload Minisite archive.
   */
  const ARCHIVE_UPLOAD_DIR = 'minisite' . DIRECTORY_SEPARATOR . 'upload';

  /**
   * Directory for assets files, where uploaded archives will be extracted to.
   */
  const ASSET_DIR = 'minisite' . DIRECTORY_SEPARATOR . 'static';

  /**
   * Default allowed extensions.
   */
  const ALLOWED_EXTENSIONS = 'html htm js css png jpg gif svg pdf doc docx ppt pptx xls xlsx tif xml txt woff woff2 ttf eot ico';

  /**
   * Extensions that can never be allowed.
   */
  const DENIED_EXTENSIONS = 'exe scr bmp';

  /**
   * Archive extensions supported by the current implementation.
   */
  const SUPPORTED_ARCHIVE_EXTENSIONS = 'zip tar';

  /**
   * Create an instance of this class from the field items.
   *
   * @param \Drupal\Core\Field\FieldItemListInterface $items
   *   The existing field items.
   *
   * @return \Drupal\minisite\Minisite
   *   An instance of this class.
   */
  public static function createInstance(FieldItemListInterface $items);

  /**
   * Get archive file.
   *
   * @return \Drupal\file\FileInterface
   *   Archive file used to instantiate this minisite.
   */
  public function getArchiveFile();

  /**
   * Set archive file.
   *
   * @param \Drupal\file\FileInterface $file
   *   Already uploaded archive file object to set.
   */
  public function setArchiveFile(FileInterface $file);

  /**
   * Get description.
   *
   * @return string
   *   The description string.
   */
  public function getDescription();

  /**
   * Set description.
   *
   * @param string $description
   *   The description to set.
   */
  public function setDescription($description);

  /**
   * Get asset entry point URL.
   *
   * @return string
   *   URL as a relative path to the asset or an alias.
   *
   * @see \Drupal\minisite\AssetInterface::INDEX_FILE
   */
  public function getIndexAssetUrl();

  /**
   * Get asset entry point URI.
   *
   * @return string
   *   URI of the file which is an entry point for the minisite.
   *
   * @see \Drupal\minisite\AssetInterface::INDEX_FILE
   */
  public function getIndexAssetUri();

  /**
   * Save minisite.
   *
   * Note that assets would already be extracted.
   */
  public function save();

  /**
   * Delete minisite.
   */
  public function delete();

  /**
   * Validate archive.
   *
   * Can be used at early stages before Minisite instance is created (i.e. when
   * uploading a file) to validate the archive.
   *
   * @param \Drupal\file\FileInterface $file
   *   The archive file to validate.
   * @param string $content_extensions
   *   Space-separated string list of allowed file extensions in the archive.
   *
   * @throws \Drupal\minisite\Exception\ArchiveException
   *   Throws one of the descendants of this exception based on validation
   *   failures.
   */
  public static function validateArchive(FileInterface $file, $content_extensions);

  /**
   * Path to the common directory with uploaded Minisite archive files.
   */
  public static function getCommonArchiveDir();

  /**
   * Path to the common directory with extracted Minisite archive files.
   */
  public static function getCommonAssetDir();

  /**
   * Get supported archive extensions.
   *
   * @return array
   *   Array of supported archive extensions.
   */
  public static function supportedArchiveExtensions();

  /**
   * Get cache tags for this site.
   *
   * @return string[]
   *   Array of cache tags.
   */
  public function getCacheTags();

  /**
   * Get the path to the asset directory.
   *
   * @return string
   *   The path to the assets directory.
   */
  public function getAssetDirectory();

}

Members

Namesort descending Modifiers Type Description Overrides
MinisiteInterface::ALLOWED_EXTENSIONS constant Default allowed extensions.
MinisiteInterface::ARCHIVE_UPLOAD_DIR constant Directory to upload Minisite archive.
MinisiteInterface::ASSET_DIR constant Directory for assets files, where uploaded archives will be extracted to.
MinisiteInterface::createInstance public static function Create an instance of this class from the field items. 1
MinisiteInterface::delete public function Delete minisite. 1
MinisiteInterface::DENIED_EXTENSIONS constant Extensions that can never be allowed.
MinisiteInterface::getArchiveFile public function Get archive file. 1
MinisiteInterface::getAssetDirectory public function Get the path to the asset directory. 1
MinisiteInterface::getCacheTags public function Get cache tags for this site. 1
MinisiteInterface::getCommonArchiveDir public static function Path to the common directory with uploaded Minisite archive files. 1
MinisiteInterface::getCommonAssetDir public static function Path to the common directory with extracted Minisite archive files. 1
MinisiteInterface::getDescription public function Get description. 1
MinisiteInterface::getIndexAssetUri public function Get asset entry point URI. 1
MinisiteInterface::getIndexAssetUrl public function Get asset entry point URL. 1
MinisiteInterface::save public function Save minisite. 1
MinisiteInterface::setArchiveFile public function Set archive file. 1
MinisiteInterface::setDescription public function Set description. 1
MinisiteInterface::supportedArchiveExtensions public static function Get supported archive extensions. 1
MinisiteInterface::SUPPORTED_ARCHIVE_EXTENSIONS constant Archive extensions supported by the current implementation.
MinisiteInterface::validateArchive public static function Validate archive. 1