You are here

function google_cse_language in Google Custom Search Engine 8.3

Same name and namespace in other branches
  1. 8.2 google_cse.module \google_cse_language()
  2. 7 google_cse.module \google_cse_language()
  3. 7.2 google_cse.module \google_cse_language()

Get the relevant language to use for the search.

Return value

string The language.

2 calls to google_cse_language()
GoogleCSEBlock::build in src/Plugin/Block/GoogleCSEBlock.php
Builds and returns the renderable array for this block plugin.
google_cse_form_search_block_form_alter in ./google_cse.module
Adds custom submit handler for search block form.

File

./google_cse.module, line 41
Display a Google Custom Search Engine (CSE) on your site.

Code

function google_cse_language() {
  $config = \Drupal::config('search.page.google_cse_search')
    ->get('configuration');
  return isset($config['locale_hl']) ? \Drupal::languageManager()
    ->getCurrentLanguage()
    ->getId() : $config['hl'];
}