function SearchPluginBase::suggestedTitle
Same name in other branches
- 9 core/modules/search/src/Plugin/SearchPluginBase.php \Drupal\search\Plugin\SearchPluginBase::suggestedTitle()
- 8.9.x core/modules/search/src/Plugin/SearchPluginBase.php \Drupal\search\Plugin\SearchPluginBase::suggestedTitle()
- 10 core/modules/search/src/Plugin/SearchPluginBase.php \Drupal\search\Plugin\SearchPluginBase::suggestedTitle()
Overrides SearchInterface::suggestedTitle
File
-
core/
modules/ search/ src/ Plugin/ SearchPluginBase.php, line 122
Class
- SearchPluginBase
- Defines a base class for plugins wishing to support search.
Namespace
Drupal\search\PluginCode
public function suggestedTitle() {
// If the user entered a search string, truncate it and append it to the
// title.
if (!empty($this->keywords)) {
return $this->t('Search for @keywords', [
'@keywords' => Unicode::truncate($this->keywords, 60, TRUE, TRUE),
]);
}
// Use the default 'Search' title.
return $this->t('Search');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.