protected function FileDownloadLink::getTokenWarningMarkup in File Download Link 8
A helper function for the config form.
Return value
string An example of what token could do for you.
1 call to FileDownloadLink::getTokenWarningMarkup()
- FileDownloadLink::settingsForm in src/
Plugin/ Field/ FieldFormatter/ FileDownloadLink.php - Returns a form to configure settings for the formatter.
File
- src/
Plugin/ Field/ FieldFormatter/ FileDownloadLink.php, line 374
Class
- FileDownloadLink
- Plugin implementation of the 'file_download_link' formatter.
Namespace
Drupal\file_download_link\Plugin\Field\FieldFormatterCode
protected function getTokenWarningMarkup() {
$type = $this->fieldDefinition
->getType();
if ($type == 'file') {
return $this
->t('<p>Enable the <a href="https://www.drupal.org/project/token\\" target="_blank\\">token module</a> to allow more flexible link text. For example, you would be able show the file description followed by the file size like this:<code>@example</code></p>', [
'@example' => $this
->getExampleToken(),
]);
}
else {
return $this
->t('<p>Enable the <a href="https://www.drupal.org/project/token" target="_blank">token module</a> to allow more flexible link text. For example, you would be able show the alt text followed by the file size like this:<code>@example</code></p>', [
'@example' => $this
->getExampleToken(),
]);
}
}