Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. SearchPluginBase.php

function 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\Plugin

Code

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');
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal