class Attribution in Openlayers 8.4
Defines the Attribution control for an Openlayers map.
Plugin annotation
@OpenlayersControl(
id = "ol_control_attribution",
label = @Translation("Attribution"),
description = @Translation("Define an attribution control."),
type = "control",
ol_id = "Attribution"
)
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, MessengerTrait, StringTranslationTrait
- class \Drupal\openlayers\OpenlayersPluginBase implements ContainerFactoryPluginInterface, OpenlayersPluginInterface
- class \Drupal\openlayers\OpenlayersConfigurablePluginBase implements OpenlayersConfigurablePluginInterface
- class \Drupal\openlayers\Plugin\OpenlayersControl\Attribution
- class \Drupal\openlayers\OpenlayersConfigurablePluginBase implements OpenlayersConfigurablePluginInterface
- class \Drupal\openlayers\OpenlayersPluginBase implements ContainerFactoryPluginInterface, OpenlayersPluginInterface
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, MessengerTrait, StringTranslationTrait
Expanded class hierarchy of Attribution
2 string references to 'Attribution'
- openlayers.control.ol_attribution.yml in config/
install/ openlayers.control.ol_attribution.yml - config/install/openlayers.control.ol_attribution.yml
- OpenlayersControlFormBase::buildForm in src/
Form/ OpenlayersControlFormBase.php - Overrides Drupal\Core\Entity\EntityFormController::form().
File
- src/
Plugin/ OpenlayersControl/ Attribution.php, line 21
Namespace
Drupal\openlayers\Plugin\OpenlayersControlView source
class Attribution extends OpenlayersConfigurablePluginBase {
/**
* {@inheritdoc}
*/
public function getSummary() {
$summary = [
'#theme' => 'openlayers_control_attribution_summary',
'#data' => $this->configuration,
];
$summary += parent::getSummary();
return $summary;
}
/**
* {@inheritdoc}
*/
public function defaultConfiguration() {
return [
'className' => 'ol-attribution',
'collapsible' => TRUE,
'collapsed' => FALSE,
'tipLabel' => 'Attributions',
'label' => 'aaaaaaaaaaaaaa',
'collapseLabel' => 'bbbbbbbbbbbbbbbb',
];
}
/**
* {@inheritdoc}
*/
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$form['className'] = [
'#type' => 'textfield',
'#default_value' => $this->configuration['className'],
'#title' => t('Class name'),
'#description' => t('CSS class name.'),
'#size' => 50,
'#maxlength' => 50,
'#required' => FALSE,
];
$form['collapsible'] = array(
'#type' => 'checkbox',
'#title' => $this
->t('Collapsible'),
'#description' => t('Specify if attributions can be collapsed.'),
'#default_value' => $this->configuration['collapsible'],
);
$form['collapsed'] = array(
'#type' => 'checkbox',
'#title' => $this
->t('Collapsed'),
'#description' => t('Specify if attributions should be collapsed at startup.'),
'#default_value' => $this->configuration['collapsed'],
);
$form['tipLabel'] = [
'#type' => 'textfield',
'#default_value' => $this->configuration['tipLabel'],
'#title' => t('Tip label'),
'#description' => t('Text label to use for the button tip.'),
'#size' => 100,
'#maxlength' => 100,
'#required' => FALSE,
];
$form['label'] = [
'#type' => 'textfield',
'#default_value' => $this->configuration['label'],
'#title' => t('Label'),
'#description' => t('Text label to use for the collapsed attributions button.'),
'#size' => 100,
'#maxlength' => 100,
'#required' => FALSE,
];
$form['collapseLabel'] = [
'#type' => 'textfield',
'#default_value' => $this->configuration['collapseLabel'],
'#title' => t('Collapse label'),
'#description' => t('Text label to use for the expanded attributions button.'),
'#size' => 100,
'#maxlength' => 100,
'#required' => FALSE,
];
return $form;
}
/**
* {@inheritdoc}
*/
public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
/*
if (!$form_state->isValueEmpty('color') && !Color::validateHex($form_state->getValue('color'))) {
$form_state->setErrorByName('color', $this->t('Color must be a hexadecimal color value.'));
}
*/
}
/**
* {@inheritdoc}
*/
public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
parent::submitConfigurationForm($form, $form_state);
$this->configuration['className'] = $form_state
->getValue('className');
$this->configuration['collapsible'] = $form_state
->getValue('collapsible');
$this->configuration['collapsed'] = $form_state
->getValue('collapsed');
$this->configuration['tipLabel'] = $form_state
->getValue('tipLabel');
$this->configuration['label'] = $form_state
->getValue('label');
$this->configuration['collapseLabel'] = $form_state
->getValue('collapseLabel');
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Attribution:: |
public | function |
Form constructor. Overrides PluginFormInterface:: |
|
Attribution:: |
public | function |
Gets default configuration for this plugin. Overrides OpenlayersPluginBase:: |
|
Attribution:: |
public | function |
Returns a render array summarizing the configuration of the image effect. Overrides OpenlayersPluginBase:: |
|
Attribution:: |
public | function |
Form submission handler. Overrides OpenlayersConfigurablePluginBase:: |
|
Attribution:: |
public | function |
Form validation handler. Overrides OpenlayersConfigurablePluginBase:: |
|
DependencySerializationTrait:: |
protected | property | An array of entity type IDs keyed by the property name of their storages. | |
DependencySerializationTrait:: |
protected | property | An array of service IDs keyed by property name used for serialization. | |
DependencySerializationTrait:: |
public | function | 1 | |
DependencySerializationTrait:: |
public | function | 2 | |
MessengerTrait:: |
protected | property | The messenger. | 29 |
MessengerTrait:: |
public | function | Gets the messenger. | 29 |
MessengerTrait:: |
public | function | Sets the messenger. | |
OpenlayersPluginBase:: |
protected | property | A logger instance. | |
OpenlayersPluginBase:: |
protected | property | The image effect ID. | |
OpenlayersPluginBase:: |
protected | property | The weight of the image effect. | |
OpenlayersPluginBase:: |
public | function |
Calculates dependencies for the configured plugin. Overrides DependentPluginInterface:: |
|
OpenlayersPluginBase:: |
public static | function |
Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface:: |
|
OpenlayersPluginBase:: |
public | function |
Gets this plugin's configuration. Overrides ConfigurableInterface:: |
|
OpenlayersPluginBase:: |
public | function |
Returns the extension of the derivative after applying this image effect. Overrides OpenlayersPluginInterface:: |
|
OpenlayersPluginBase:: |
public | function |
Returns the unique ID representing the image effect. Overrides OpenlayersPluginInterface:: |
|
OpenlayersPluginBase:: |
public | function |
Returns the weight of the image effect. Overrides OpenlayersPluginInterface:: |
|
OpenlayersPluginBase:: |
public | function |
Returns the image effect label. Overrides OpenlayersPluginInterface:: |
|
OpenlayersPluginBase:: |
public | function |
Sets the configuration for this plugin instance. Overrides ConfigurableInterface:: |
|
OpenlayersPluginBase:: |
public | function |
Sets the weight for this image effect. Overrides OpenlayersPluginInterface:: |
|
OpenlayersPluginBase:: |
public | function |
Determines the dimensions of the styled image. Overrides OpenlayersPluginInterface:: |
|
OpenlayersPluginBase:: |
public | function |
Constructs a \Drupal\Component\Plugin\PluginBase object. Overrides PluginBase:: |
|
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. | |
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. |