class Simple in Siteimprove 8
Provides simple plugin instance of Siteimprove Domain settings.
Plugin annotation
@SiteimproveDomain(
id = "siteimprovedomain_simple",
label = @Translation("Default domain"),
description = @Translation("Don't set anything and use Drupal's default settings"),
)
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\siteimprove\Plugin\SiteimproveDomainBase implements ContainerFactoryPluginInterface, SiteimproveDomainInterface uses ConfigFormBaseTrait, StringTranslationTrait
- class \Drupal\siteimprove\Plugin\SiteimproveDomain\Simple
- class \Drupal\siteimprove\Plugin\SiteimproveDomainBase implements ContainerFactoryPluginInterface, SiteimproveDomainInterface uses ConfigFormBaseTrait, StringTranslationTrait
Expanded class hierarchy of Simple
File
- src/
Plugin/ SiteimproveDomain/ Simple.php, line 21
Namespace
Drupal\siteimprove\Plugin\SiteimproveDomainView source
class Simple extends SiteimproveDomainBase {
/**
* Current request service.
*
* @var \Symfony\Component\HttpFoundation\Request
*/
protected $request;
/**
* {@inheritDoc}
*/
public function __construct(array $configuration, $plugin_id, array $plugin_definition, ConfigFactoryInterface $configFactory, Request $request) {
parent::__construct($configuration, $plugin_id, $plugin_definition, $configFactory);
$this->request = $request;
}
/**
* {@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'), $container
->get('request_stack')
->getCurrentRequest());
}
/**
* {@inheritdoc}
*/
public function buildForm(array &$form, FormStateInterface &$form_state, $plugin_definition) {
parent::buildForm($form, $form_state, $plugin_definition);
$form[$plugin_definition['id']]['description'] = [
'#type' => 'markup',
'#markup' => $this
->t("This plugin doesn't contain any settings."),
];
return $form;
}
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
// @TODO: Can we remove this?
parent::submitForm($form, $form_state);
}
/**
* Return default domain.
*
* @param \Drupal\Core\Entity\EntityInterface $entity
* We don't use the entity in this plugin.
*
* @return array
* Array of domains.
*/
public function getUrls(EntityInterface $entity) {
$domain = $this->request
->getScheme() . '://' . $this->request
->getHttpHost();
return [
$domain,
];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ConfigFormBaseTrait:: |
protected | function | Retrieves a configuration object. | |
PluginBase:: |
protected | property | Configuration information passed into the plugin. | 1 |
PluginBase:: |
protected | property | The plugin implementation definition. | 1 |
PluginBase:: |
protected | property | The plugin_id. | |
PluginBase:: |
constant | A string which is used to separate base plugin IDs from the derivative ID. | ||
PluginBase:: |
public | function |
Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the definition of the plugin implementation. Overrides PluginInspectionInterface:: |
3 |
PluginBase:: |
public | function |
Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function | Determines if the plugin is configurable. | |
Simple:: |
protected | property | Current request service. | |
Simple:: |
public | function |
Form constructor. Overrides SiteimproveDomainBase:: |
|
Simple:: |
public static | function |
Creates an instance of the plugin. Overrides SiteimproveDomainBase:: |
|
Simple:: |
public | function |
Return default domain. Overrides SiteimproveDomainBase:: |
|
Simple:: |
public | function |
Form submission handler. Overrides SiteimproveDomainBase:: |
|
Simple:: |
public | function |
Constructs a new SiteimproveDomainBase object. Overrides SiteimproveDomainBase:: |
|
SiteimproveDomainBase:: |
protected | property | The config factory. | |
SiteimproveDomainBase:: |
protected | function |
Gets the configuration names that will be editable. Overrides ConfigFormBaseTrait:: |
1 |
SiteimproveDomainBase:: |
public | function | ||
SiteimproveDomainBase:: |
public | function |
Form validation handler. Overrides SiteimproveDomainInterface:: |
1 |
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |