function language

Returns the language object for a given language type.

Parameters

string $type: The type of language object needed, e.g. Language::TYPE_INTERFACE.

Deprecated

as of Drupal 8.0. Use Drupal::service('language_manager')->getLanguage($type).

See also

Drupal\Core\Language\LanguageManager

53 calls to language()
AccountFormController::form in drupal/core/modules/user/lib/Drupal/user/AccountFormController.php
Overrides Drupal\Core\Entity\EntityFormController::form().
CascadingStylesheetsTest::testAlter in drupal/core/modules/system/lib/Drupal/system/Tests/Common/CascadingStylesheetsTest.php
Tests Locale module's CSS Alter to include RTL overrides.
CKEditor::getJSSettings in drupal/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/Editor/CKEditor.php
Implements \Drupal\editor\Plugin\EditPluginInterface::getJSSettings().
CommentFormController::form in drupal/core/modules/comment/lib/Drupal/comment/CommentFormController.php
Overrides Drupal\Core\Entity\EntityFormController::form().
CommentTokenReplaceTest::testCommentTokenReplacement in drupal/core/modules/comment/lib/Drupal/comment/Tests/CommentTokenReplaceTest.php
Creates a comment, then tests the tokens generated from it.

... See full list

72 string references to 'language'
AccountSettingsForm::buildForm in drupal/core/modules/user/lib/Drupal/user/AccountSettingsForm.php
Implements \Drupal\Core\Form\FormInterface::buildForm().
BlockFormController::form in drupal/core/modules/block/lib/Drupal/block/BlockFormController.php
Overrides \Drupal\Core\Entity\EntityFormController::form().
comment_update_8000 in drupal/core/modules/comment/comment.install
Renames {comment}.language to {comment}.langcode.
comment_views_data in drupal/core/modules/comment/comment.views.inc
Implements hook_views_data().
ConfigLocaleOverride::testConfigLocaleUserAndGlobalOverride in drupal/core/modules/config/lib/Drupal/config/Tests/ConfigLocaleOverride.php
Tests locale override in combination with global overrides.

... See full list

File

drupal/core/includes/bootstrap.inc, line 2437
Functions that need to be loaded on every Drupal request.

Code

function language($type) {
  return Drupal::service('language_manager')
    ->getLanguage($type);
}