You are here

public function GoogleCSEServices::paramhl in Google Custom Search Engine 8.2

Same name and namespace in other branches
  1. 8.3 src/GoogleCSEServices.php \Drupal\google_cse\GoogleCSEServices::paramhl()

Returns "hl" language param for search request.

Return value

string The language code.

1 call to GoogleCSEServices::paramhl()
GoogleCSEServices::service in src/GoogleCSEServices.php
Sends query to Google's Custom Search Engine and returns response.

File

src/GoogleCSEServices.php, line 155

Class

GoogleCSEServices
Additional functions as services for Google CSE.

Namespace

Drupal\google_cse

Code

public function paramhl() {
  $language = $this->CSEconfig
    ->get('configuration')['google_cse_adv_language'];
  switch ($language) {
    case 'active':
      $language = $this->languageManager
        ->getCurrentLanguage();
      return $language
        ->getId();
    default:
      return '';
  }
}