You are here

abstract class SiteimproveDomainBase in Siteimprove 8

Base class for Siteimprove domain plugins.

Hierarchy

Expanded class hierarchy of SiteimproveDomainBase

3 files declare their use of SiteimproveDomainBase
DomainAccess.php in siteimprove_domain_access/src/Plugin/SiteimproveDomain/DomainAccess.php
Simple.php in src/Plugin/SiteimproveDomain/Simple.php
Single.php in src/Plugin/SiteimproveDomain/Single.php

File

src/Plugin/SiteimproveDomainBase.php, line 17

Namespace

Drupal\siteimprove\Plugin
View source
abstract class SiteimproveDomainBase extends PluginBase implements ContainerFactoryPluginInterface, SiteimproveDomainInterface {
  use StringTranslationTrait;
  use ConfigFormBaseTrait;

  /**
   * The config factory.
   *
   * Subclasses should use the self::config() method, which may be overridden to
   * address specific needs when loading config, rather than this property
   * directly. See \Drupal\Core\Form\ConfigFormBase::config() for an example of
   * this.
   *
   * @var \Drupal\Core\Config\ConfigFactoryInterface
   */
  protected $configFactory;

  /**
   * Constructs a new SiteimproveDomainBase object.
   *
   * @param array $configuration
   *   A configuration array containing information about the plugin instance.
   * @param string $plugin_id
   *   The plugin_id for the plugin instance.
   * @param array $plugin_definition
   *   The plugin implementation definition.
   * @param \Drupal\Core\Config\ConfigFactoryInterface $configFactory
   *   The config factory.
   */
  public function __construct(array $configuration, $plugin_id, array $plugin_definition, ConfigFactoryInterface $configFactory) {
    parent::__construct($configuration, $plugin_id, $plugin_definition);
    $this->configFactory = $configFactory;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
    return new static($configuration, $plugin_id, $plugin_definition, $container
      ->get('config.factory'));
  }

  /**
   * {@inheritdoc}
   */
  public function getName() {
    return $this->pluginDefinition['name'];
  }

  /**
   * {@inheritdoc}
   */
  public function buildForm(array &$form, FormStateInterface &$form_state, $plugin_definition) {
    $form[$plugin_definition['id']] = [
      '#type' => 'fieldset',
      '#title' => $plugin_definition['label'],
    ];
  }

  /**
   * {@inheritdoc}
   */
  public function validateForm(array &$form, FormStateInterface $form_state) {
  }

  /**
   * {@inheritdoc}
   */
  public function submitForm(array &$form, FormStateInterface $form_state) {
  }

  /**
   * Return urls for active domains for this entity.
   *
   * If http/https isn't specified in domain name, use the backend's scheme.
   *
   * @param \Drupal\Core\Entity\EntityInterface $entity
   *   Entity to get active domain names for.
   *
   * @return array
   *   Array of domain names without trailing slash.
   */
  public function getUrls(EntityInterface $entity) {
    return [];
  }

  /**
   * {@inheritdoc}
   */
  protected function getEditableConfigNames() {
    return [];
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ConfigFormBaseTrait::config protected function Retrieves a configuration object.
PluginBase::$configuration protected property Configuration information passed into the plugin. 1
PluginBase::$pluginDefinition protected property The plugin implementation definition. 1
PluginBase::$pluginId protected property The plugin_id.
PluginBase::DERIVATIVE_SEPARATOR constant A string which is used to separate base plugin IDs from the derivative ID.
PluginBase::getBaseId public function Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface::getBaseId
PluginBase::getDerivativeId public function Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface::getDerivativeId
PluginBase::getPluginDefinition public function Gets the definition of the plugin implementation. Overrides PluginInspectionInterface::getPluginDefinition 3
PluginBase::getPluginId public function Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface::getPluginId
PluginBase::isConfigurable public function Determines if the plugin is configurable.
SiteimproveDomainBase::$configFactory protected property The config factory.
SiteimproveDomainBase::buildForm public function Form constructor. Overrides SiteimproveDomainInterface::buildForm 3
SiteimproveDomainBase::create public static function Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface::create 2
SiteimproveDomainBase::getEditableConfigNames protected function Gets the configuration names that will be editable. Overrides ConfigFormBaseTrait::getEditableConfigNames 1
SiteimproveDomainBase::getName public function
SiteimproveDomainBase::getUrls public function Return urls for active domains for this entity. 3
SiteimproveDomainBase::submitForm public function Form submission handler. Overrides SiteimproveDomainInterface::submitForm 3
SiteimproveDomainBase::validateForm public function Form validation handler. Overrides SiteimproveDomainInterface::validateForm 1
SiteimproveDomainBase::__construct public function Constructs a new SiteimproveDomainBase object. Overrides PluginBase::__construct 2
StringTranslationTrait::$stringTranslation protected property The string translation service. 1
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.