public function GoogleSearch::buildLink in Freelinking 4.0.x
Same name and namespace in other branches
- 8.3 src/Plugin/freelinking/GoogleSearch.php \Drupal\freelinking\Plugin\freelinking\GoogleSearch::buildLink()
Build a link with the plugin.
Parameters
array $target: The target array with including the following keys:
- text: The text to display in the URL.
- indicator: The indicator string.
- dest: The destination string for the plugin to turn into a URI.
- tooltip: An optional tooltip.
- language: A language object.
Return value
array Link array.
Overrides FreelinkingPluginInterface::buildLink
File
- src/
Plugin/ freelinking/ GoogleSearch.php, line 40
Class
- GoogleSearch
- Freelinking google search plugin.
Namespace
Drupal\freelinking\Plugin\freelinkingCode
public function buildLink(array $target) {
$searchString = str_replace(' ', '+', $target['dest']);
$tooltip = isset($target['tooltip']) ? $target['tooltip'] : $this
->getTip();
return self::createRenderArray($searchString, $target['text'], $target['language'], $tooltip);
}