You are here

public static function Language::load in Little helpers 7.2

Same name and namespace in other branches
  1. 7 src/Locale/Language.php \Drupal\little_helpers\Locale\Language::load()

Load language from database.

Parameters

string language code of the language to load from DB.:

Return value

Language object if there is such a language in the database, else NULL.

1 call to Language::load()
Language::save in src/Locale/Language.php
Save language to the database and call hooks as needed.

File

src/Locale/Language.php, line 61

Class

Language
Model object for the {languages} table.

Namespace

Drupal\little_helpers\Locale

Code

public static function load($langcode) {
  $row = \db_select('languages', 'l')
    ->fields('l')
    ->condition('language', $langcode)
    ->execute()
    ->fetch();
  if ($row) {
    return new static($row);
  }
}