Add new comment | Drupal 8

Add new comment

Navneet Singh (not verified)

Sun, 01/15/2017 - 10:18

Drupal 7:

global $language;
// return lang code;
return $language->language;

Drupal 8:

return $language = \Drupal::languageManager()->getCurrentLanguage()->getId();

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.