interface StyleDiscoveryInterface

Provides discovery for a YAML style files in specific directories.

@package Drupal\paragraphs_collection

Hierarchy

Expanded class hierarchy of StyleDiscoveryInterface

All classes that implement StyleDiscoveryInterface

3 files declare their use of StyleDiscoveryInterface
OverviewController.php in paragraphs_collection/src/Controller/OverviewController.php
ParagraphsStylePlugin.php in paragraphs_collection/src/Plugin/paragraphs/Behavior/ParagraphsStylePlugin.php
StylesOverviewForm.php in paragraphs_collection/src/Form/StylesOverviewForm.php

File

paragraphs_collection/src/StyleDiscoveryInterface.php, line 12

Namespace

Drupal\paragraphs_collection
View source
interface StyleDiscoveryInterface {

  /**
   * Gets libraries for a specific style or empty list if style is not found.
   *
   * @param $style
   *   The name of the style.
   * @return array
   *   The names of the libraries, or empty list if not found.
   */
  public function getLibraries($style);

  /**
   * Gets sorted style titles keyed by their names belonging to the given group.
   *
   * If an empty string is given, returns all styles.
   *
   * @param string $group
   *   (optional) The style group. Defaults to empty string.
   * @param bool $access_check
   *   (optional) Whether we should check the style access. Defaults to false.
   *
   * @return array
   *   An array of style titles keyed by the respective style machine names.
   */
  public function getStyleOptions($group = '', $access_check = FALSE);

  /**
   * Gets style groups.
   *
   * @return array
   *    Collection of style groups.
   */
  public function getStyleGroups();

  /**
   * Gets style groups label.
   *
   * @return array
   *    Collection of style groups labels.
   */
  public function getStyleGroupsLabel();

  /**
   * Returns associative array of name and definition of style.
   *
   * @return array
   *   Collection of styles.
   */
  public function getStyles();

  /**
   * Get style by name.
   *
   * @param string $style
   *   The style name.
   * @param string|null $default
   *   (optional) The default style if the specified style does not exist.
   *
   * @return array|null
   *   The style configuration array of the given style or NULL.
   */
  public function getStyle($style, $default = NULL);

  /**
   * Checks whether the given account has access to the given style name.
   *
   * @param array $style_definition
   *   The style definition.
   * @param \Drupal\Core\Session\AccountProxyInterface|null $account
   *   (optional) The account to check access for. Defaults to current user.
   *
   * @return bool
   *   TRUE if the user has access to the style. Otherwise, FALSE.
   */
  public function isAllowedAccess(array $style_definition, AccountProxyInterface $account = NULL);

  /**
   * Gets group label.
   *
   * @param string $group_id
   *   The group id.
   *
   * @return string
   *   The translatable group label.
   */
  public function getGroupLabel($group_id);

  /**
   * Gets group label for a widget context.
   *
   * @param string $group_id
   *   The group id.
   *
   * @return \Drupal\Core\StringTranslation\TranslatableMarkup
   *   The translatable group label.
   */
  public function getGroupWidgetLabel($group_id);

  /**
   * Reset the cached definitions.
   */
  public function reset();

}

Members

Namesort descending Modifiers Type Description Overrides
StyleDiscoveryInterface::getGroupLabel public function Gets group label. 1
StyleDiscoveryInterface::getGroupWidgetLabel public function Gets group label for a widget context. 1
StyleDiscoveryInterface::getLibraries public function Gets libraries for a specific style or empty list if style is not found. 1
StyleDiscoveryInterface::getStyle public function Get style by name. 1
StyleDiscoveryInterface::getStyleGroups public function Gets style groups. 1
StyleDiscoveryInterface::getStyleGroupsLabel public function Gets style groups label. 1
StyleDiscoveryInterface::getStyleOptions public function Gets sorted style titles keyed by their names belonging to the given group. 1
StyleDiscoveryInterface::getStyles public function Returns associative array of name and definition of style. 1
StyleDiscoveryInterface::isAllowedAccess public function Checks whether the given account has access to the given style name. 1
StyleDiscoveryInterface::reset public function Reset the cached definitions. 1