protected function LeafletSettingsElementsTrait::setReplacementPatternsElement in Leaflet 2.1.x
Same name and namespace in other branches
- 2.0.x src/LeafletSettingsElementsTrait.php \Drupal\leaflet\LeafletSettingsElementsTrait::setReplacementPatternsElement()
Set Replacement Patterns Element.
Parameters
array $element: The Form element to alter.
2 calls to LeafletSettingsElementsTrait::setReplacementPatternsElement()
- LeafletDefaultFormatter::settingsForm in src/
Plugin/ Field/ FieldFormatter/ LeafletDefaultFormatter.php - Returns a form to configure settings for the formatter.
- LeafletDefaultWidget::settingsForm in src/
Plugin/ Field/ FieldWidget/ LeafletDefaultWidget.php
File
- src/
LeafletSettingsElementsTrait.php, line 656
Class
- LeafletSettingsElementsTrait
- Class LeafletSettingsElementsTrait.
Namespace
Drupal\leafletCode
protected function setReplacementPatternsElement(array &$element) {
if ($this->moduleHandler
->moduleExists('token')) {
$element['replacement_patterns'] = [
'#type' => 'details',
'#title' => 'Replacement patterns',
'#description' => $this
->t('The following replacement tokens are available for the "Popup Content and the Icon Options":'),
];
$element['replacement_patterns']['token_help'] = [
'#theme' => 'token_tree_link',
'#token_types' => [
$this->fieldDefinition
->getTargetEntityTypeId(),
],
];
}
else {
$element['replacement_patterns']['#description'] = $this
->t('The @token_link is needed to browse and use @entity_type entity token replacements.', [
'@token_link' => $this->link
->generate(t('Token module'), Url::fromUri('https://www.drupal.org/project/token', [
'absolute' => TRUE,
'attributes' => [
'target' => 'blank',
],
])),
'@entity_type' => $this->fieldDefinition
->getTargetEntityTypeId(),
]);
}
}