Commit 49a90046 authored by webchick's avatar webchick

Issue #2246665 by jaredsmith, martin107, YesCT, filijonka, tstoeckler:...

Issue #2246665 by jaredsmith, martin107, YesCT, filijonka, tstoeckler: Typehint with Drupal\Core\Language\LanguageInterface instead Drupal\Core\Language\Language.
parent c81a6ef8
......@@ -26,6 +26,7 @@
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Drupal\Core\Language\Language;
use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\Lock\DatabaseLockBackend;
use Drupal\Core\Lock\LockBackendInterface;
use Drupal\Core\Session\AnonymousUserSession;
......@@ -1812,8 +1813,8 @@ function language($type) {
*
* @param $flags
* (optional) Specifies the state of the languages that have to be returned.
* It can be: Language::STATE_CONFIGURABLE, Language::STATE_LOCKED,
* Language::STATE_ALL.
* It can be: LanguageInterface::STATE_CONFIGURABLE,
* LanguageInterface::STATE_LOCKED, LanguageInterface::STATE_ALL.
*
* @return array
* An associative array of languages, keyed by the language code, ordered by
......@@ -1822,7 +1823,7 @@ function language($type) {
* @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0.
* Use \Drupal::languageManager()->getLanguages().
*/
function language_list($flags = Language::STATE_CONFIGURABLE) {
function language_list($flags = LanguageInterface::STATE_CONFIGURABLE) {
return \Drupal::languageManager()->getLanguages($flags);
}
......@@ -1832,7 +1833,7 @@ function language_list($flags = Language::STATE_CONFIGURABLE) {
* @param string $langcode
* The language code.
*
* @return \Drupal\core\Language\Language|null
* @return \Drupal\core\Language\LanguageInterface|null
* A fully-populated language object or NULL.
*
* @see \Drupal\Core\Language\LanguageManager::getLanguage()
......@@ -1847,7 +1848,7 @@ function language_load($langcode) {
/**
* Returns the default language used on the site.
*
* @return \Drupal\Core\Language\Language
* @return \Drupal\Core\Language\LanguageInterface
* A language object.
*
* @see \Drupal\Core\Language\LanguageManager::getLanguage()
......
......@@ -19,7 +19,7 @@
use Drupal\Component\Utility\Tags;
use Drupal\Component\Utility\UrlHelper;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Language\Language;
use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\Site\Settings;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request;
......@@ -415,7 +415,7 @@ function check_url($uri) {
* Arbitrary elements may be added using the $args associative array.
*/
function format_rss_channel($title, $link, $description, $items, $langcode = NULL, $args = array()) {
$langcode = $langcode ? $langcode : \Drupal::languageManager()->getCurrentLanguage(Language::TYPE_CONTENT)->id;
$langcode = $langcode ? $langcode : \Drupal::languageManager()->getCurrentLanguage(LanguageInterface::TYPE_CONTENT)->id;
$output = "<channel>\n";
$output .= ' <title>' . String::checkPlain($title) . "</title>\n";
......@@ -1773,7 +1773,7 @@ function _drupal_add_js($data = NULL, $options = NULL) {
'currentPath' => $current_path,
'currentPathIsAdmin' => $current_path_is_admin,
'isFront' => drupal_is_front_page(),
'currentLanguage' => \Drupal::languageManager()->getCurrentLanguage(Language::TYPE_URL)->id,
'currentLanguage' => \Drupal::languageManager()->getCurrentLanguage(LanguageInterface::TYPE_URL)->id,
);
if (!empty($current_query)) {
ksort($current_query);
......
......@@ -8,7 +8,6 @@
use Drupal\Core\Cache\Cache;
use Drupal\Core\Entity\EntityStorageException;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Language\Language;
/**
* Clears the entity render cache for all entity types.
......
......@@ -12,7 +12,6 @@
use Drupal\Component\Utility\Xss;
use Drupal\Core\Database\Database;
use Drupal\Core\Form\OptGroup;
use Drupal\Core\Language\Language;
use Drupal\Core\Render\Element;
use Drupal\Core\Template\Attribute;
use Drupal\Core\Utility\Color;
......
......@@ -7,7 +7,6 @@
use Drupal\Component\Utility\String;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Language\Language;
use Drupal\Core\Render\Element;
use Drupal\Core\Template\Attribute;
use Symfony\Cmf\Component\Routing\RouteObjectInterface;
......
......@@ -13,7 +13,6 @@
use Drupal\Component\Utility\Xss;
use Drupal\Core\Config\Config;
use Drupal\Core\Config\StorageException;
use Drupal\Core\Language\Language;
use Drupal\Core\Extension\Extension;
use Drupal\Core\Extension\ExtensionNameLengthException;
use Drupal\Core\Page\FeedLinkElement;
......
......@@ -800,14 +800,14 @@ function update_replace_permissions($replace) {
*
* @param $flags
* (optional) Specifies the state of the languages that have to be returned.
* It can be: Language::STATE_CONFIGURABLE, Language::STATE_LOCKED,
* Language::STATE_ALL.
* It can be: LanguageInterface::STATE_CONFIGURABLE,
* LanguageInterface::STATE_LOCKED, LanguageInterface::STATE_ALL.
*
* @return array
* An associative array of languages, keyed by the language code, ordered by
* weight ascending and name ascending.
*/
function update_language_list($flags = Language::STATE_CONFIGURABLE) {
function update_language_list($flags = LanguageInterface::STATE_CONFIGURABLE) {
$languages = &drupal_static(__FUNCTION__);
......@@ -853,7 +853,7 @@ function update_language_list($flags = Language::STATE_CONFIGURABLE) {
$filtered_languages = array();
// Add the site's default language if flagged as allowed value.
if ($flags & Language::STATE_SITE_DEFAULT) {
if ($flags & LanguageInterface::STATE_SITE_DEFAULT) {
$default = isset($default) ? $default : \Drupal::languageManager()->getDefaultLanguage();
// Rename the default language.
$default->name = t("Site's default language (@lang_name)", array('@lang_name' => $default->name));
......@@ -861,7 +861,7 @@ function update_language_list($flags = Language::STATE_CONFIGURABLE) {
}
foreach ($languages as $langcode => $language) {
if (($language->locked && !($flags & Language::STATE_LOCKED)) || (!$language->locked && !($flags & Language::STATE_CONFIGURABLE))) {
if (($language->locked && !($flags & LanguageInterface::STATE_LOCKED)) || (!$language->locked && !($flags & LanguageInterface::STATE_CONFIGURABLE))) {
continue;
}
$filtered_languages[$langcode] = $language;
......
......@@ -461,7 +461,8 @@ public static function urlGenerator() {
* displayed outside the site, such as in an RSS feed.
* - 'language': An optional language object used to look up the alias
* for the URL. If $options['language'] is omitted, the language will be
* obtained from \Drupal::languageManager()->getCurrentLanguage(Language::TYPE_URL).
* obtained from
* \Drupal::languageManager()->getCurrentLanguage(LanguageInterface::TYPE_URL).
* - 'https': Whether this URL should point to a secure location. If not
* defined, the current scheme is used, so the user stays on HTTP or HTTPS
* respectively. if mixed mode sessions are permitted, TRUE enforces HTTPS
......
......@@ -7,7 +7,6 @@
namespace Drupal\Core\Config;
use Drupal\Core\Language\Language;
use Drupal\Core\Language\LanguageDefault;
/**
......
......@@ -8,7 +8,7 @@
namespace Drupal\Core\Config;
use Drupal\Component\Utility\NestedArray;
use Drupal\Core\Language\Language;
use Drupal\Core\Language\LanguageInterface;
use Symfony\Component\EventDispatcher\Event;
/**
......@@ -33,7 +33,7 @@ class ConfigModuleOverridesEvent extends Event {
/**
* The Language object used to override configuration data.
*
* @var \Drupal\Core\Language\Language
* @var \Drupal\Core\Language\LanguageInterface
*/
protected $language;
......@@ -42,10 +42,10 @@ class ConfigModuleOverridesEvent extends Event {
*
* @param array $names
* A list of configuration names.
* @param \Drupal\Core\Language\Language
* @param \Drupal\Core\Language\LanguageInterface
* (optional) The language for this configuration.
*/
public function __construct(array $names, Language $language = NULL) {
public function __construct(array $names, LanguageInterface $language = NULL) {
$this->names = $names;
$this->language = $language;
$this->overrides = array();
......@@ -64,7 +64,7 @@ public function getNames() {
/**
* Gets configuration language.
*
* @return \Drupal\Core\Language\Language
* @return \Drupal\Core\Language\LanguageInterface
* The configuration language object.
*/
public function getLanguage() {
......
......@@ -14,7 +14,7 @@
use Drupal\Core\Config\ConfigDuplicateUUIDException;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Entity\EntityWithPluginBagsInterface;
use Drupal\Core\Language\Language;
use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\Plugin\PluginDependencyTrait;
/**
......@@ -83,7 +83,7 @@ abstract class ConfigEntityBase extends Entity implements ConfigEntityInterface
*
* @var string
*/
public $langcode = Language::LANGCODE_NOT_SPECIFIED;
public $langcode = LanguageInterface::LANGCODE_NOT_SPECIFIED;
/**
* Overrides Entity::__construct().
......
......@@ -7,7 +7,6 @@
namespace Drupal\Core\Datetime;
use Drupal\Component\Datetime\DateTimePlus;
use Drupal\Core\Language\Language;
/**
* Extends DateTimePlus().
......
......@@ -16,7 +16,7 @@
use Drupal\Core\Entity\Sql\SqlEntityStorageInterface;
use Drupal\Core\Field\FieldDefinitionInterface;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
use Drupal\Core\Language\Language;
use Drupal\Core\Language\LanguageInterface;
use Drupal\field\FieldConfigUpdateForbiddenException;
use Drupal\field\FieldConfigInterface;
use Drupal\field\FieldInstanceConfigInterface;
......@@ -381,12 +381,12 @@ protected function mapFromStorageRecords(array $records) {
// that store several properties).
if ($field_name = strstr($name, '__', TRUE)) {
$property_name = substr($name, strpos($name, '__') + 2);
$entities[$id][$field_name][Language::LANGCODE_DEFAULT][$property_name] = $value;
$entities[$id][$field_name][LanguageInterface::LANGCODE_DEFAULT][$property_name] = $value;
}
else {
// Handle columns named directly after the field (e.g if the field
// type only stores one property).
$entities[$id][$name][Language::LANGCODE_DEFAULT] = $value;
$entities[$id][$name][LanguageInterface::LANGCODE_DEFAULT] = $value;
}
}
// If we have no multilingual values we can instantiate entity objecs
......@@ -427,7 +427,7 @@ protected function attachPropertyData(array &$entities) {
// Get the revision IDs.
$revision_ids = array();
foreach ($entities as $values) {
$revision_ids[] = is_object($values) ? $values->getRevisionId() : $values[$this->revisionKey][Language::LANGCODE_DEFAULT];
$revision_ids[] = is_object($values) ? $values->getRevisionId() : $values[$this->revisionKey][LanguageInterface::LANGCODE_DEFAULT];
}
$query->condition($this->revisionKey, $revision_ids);
}
......@@ -447,8 +447,8 @@ protected function attachPropertyData(array &$entities) {
$id = $values[$this->idKey];
// Field values in default language are stored with
// Language::LANGCODE_DEFAULT as key.
$langcode = empty($values['default_langcode']) ? $values['langcode'] : Language::LANGCODE_DEFAULT;
// LanguageInterface::LANGCODE_DEFAULT as key.
$langcode = empty($values['default_langcode']) ? $values['langcode'] : LanguageInterface::LANGCODE_DEFAULT;
$translations[$id][$langcode] = TRUE;
......@@ -467,7 +467,7 @@ protected function attachPropertyData(array &$entities) {
}
foreach ($entities as $id => $values) {
$bundle = $this->bundleKey ? $values[$this->bundleKey][Language::LANGCODE_DEFAULT] : FALSE;
$bundle = $this->bundleKey ? $values[$this->bundleKey][LanguageInterface::LANGCODE_DEFAULT] : FALSE;
// Turn the record into an entity class.
$entities[$id] = new $this->entityClass($values, $this->entityTypeId, $bundle, array_keys($translations[$id]));
}
......@@ -962,7 +962,7 @@ protected function doLoadFieldItems($entities, $age) {
}
// Load field data.
$langcodes = array_keys(language_list(Language::STATE_ALL));
$langcodes = array_keys(language_list(LanguageInterface::STATE_ALL));
foreach ($fields as $field_name => $field) {
$table = $load_current ? static::_fieldTableName($field) : static::_fieldRevisionTableName($field);
......
......@@ -17,6 +17,7 @@
use Drupal\Core\Entity\Exception\NoCorrespondingEntityClassException;
use Drupal\Core\Entity\Exception\UndefinedLinkTemplateException;
use Drupal\Core\Language\Language;
use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\Url;
......@@ -283,7 +284,7 @@ public function access($operation, AccountInterface $account = NULL) {
}
return $this->entityManager()
->getAccessController($this->entityTypeId)
->access($this, $operation, Language::LANGCODE_DEFAULT, $account);
->access($this, $operation, LanguageInterface::LANGCODE_DEFAULT, $account);
}
/**
......@@ -293,7 +294,7 @@ public function language() {
$language = $this->languageManager()->getLanguage($this->langcode);
if (!$language) {
// Make sure we return a proper language object.
$language = new Language(array('id' => Language::LANGCODE_NOT_SPECIFIED));
$language = new Language(array('id' => LanguageInterface::LANGCODE_NOT_SPECIFIED));
}
return $language;
}
......
......@@ -11,7 +11,7 @@
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Field\FieldDefinitionInterface;
use Drupal\Core\Language\Language;
use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\Session\AccountInterface;
/**
......@@ -54,7 +54,7 @@ public function __construct(EntityTypeInterface $entity_type) {
/**
* {@inheritdoc}
*/
public function access(EntityInterface $entity, $operation, $langcode = Language::LANGCODE_DEFAULT, AccountInterface $account = NULL) {
public function access(EntityInterface $entity, $operation, $langcode = LanguageInterface::LANGCODE_DEFAULT, AccountInterface $account = NULL) {
$account = $this->prepareUser($account);
if (($access = $this->getCache($entity->uuid(), $operation, $langcode, $account)) !== NULL) {
......@@ -203,7 +203,7 @@ public function resetCache() {
public function createAccess($entity_bundle = NULL, AccountInterface $account = NULL, array $context = array()) {
$account = $this->prepareUser($account);
$context += array(
'langcode' => Language::LANGCODE_DEFAULT,
'langcode' => LanguageInterface::LANGCODE_DEFAULT,
);
$cid = $entity_bundle ? 'create:' . $entity_bundle : 'create';
......
......@@ -10,7 +10,7 @@
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Field\FieldDefinitionInterface;
use Drupal\Core\Language\Language;
use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\Session\AccountInterface;
/**
......@@ -31,7 +31,7 @@ interface EntityAccessControllerInterface {
* Usually one of "view", "update" or "delete".
* @param string $langcode
* (optional) The language code for which to check access. Defaults to
* Language::LANGCODE_DEFAULT.
* LanguageInterface::LANGCODE_DEFAULT.
* @param \Drupal\Core\Session\AccountInterface $account
* (optional) The user session for which to check access, or NULL to check
* access for the current user. Defaults to NULL.
......@@ -39,7 +39,7 @@ interface EntityAccessControllerInterface {
* @return bool
* TRUE if access was granted, FALSE otherwise.
*/
public function access(EntityInterface $entity, $operation, $langcode = Language::LANGCODE_DEFAULT, AccountInterface $account = NULL);
public function access(EntityInterface $entity, $operation, $langcode = LanguageInterface::LANGCODE_DEFAULT, AccountInterface $account = NULL);
/**
* Checks access to create an entity.
......
......@@ -37,7 +37,7 @@ public function id();
/**
* Returns the language of the entity.
*
* @return \Drupal\Core\Language\Language
* @return \Drupal\Core\Language\LanguageInterface
* The language object.
*/
public function language();
......
......@@ -16,7 +16,7 @@
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Language\LanguageManagerInterface;
use Drupal\Core\Language\Language;
use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\Plugin\DefaultPluginManager;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\Core\StringTranslation\TranslationInterface;
......@@ -732,7 +732,7 @@ public function getTranslationFromContext(EntityInterface $entity, $langcode = N
if ($entity instanceof TranslatableInterface) {
if (empty($langcode)) {
$langcode = $this->languageManager->getCurrentLanguage(Language::TYPE_CONTENT)->id;
$langcode = $this->languageManager->getCurrentLanguage(LanguageInterface::TYPE_CONTENT)->id;
}
// Retrieve language fallback candidates to perform the entity language
......@@ -743,7 +743,7 @@ public function getTranslationFromContext(EntityInterface $entity, $langcode = N
// Ensure the default language has the proper language code.
$default_language = $entity->getUntranslated()->language();
$candidates[$default_language->id] = Language::LANGCODE_DEFAULT;
$candidates[$default_language->id] = LanguageInterface::LANGCODE_DEFAULT;
// Return the most fitting entity translation.
foreach ($candidates as $candidate) {
......@@ -797,7 +797,7 @@ public function getFormModes($entity_type_id) {
protected function getAllDisplayModesByEntityType($display_type) {
if (!isset($this->displayModeInfo[$display_type])) {
$key = 'entity_' . $display_type . '_info';
$langcode = $this->languageManager->getCurrentLanguage(Language::TYPE_INTERFACE)->id;
$langcode = $this->languageManager->getCurrentLanguage(LanguageInterface::TYPE_INTERFACE)->id;
if ($cache = $this->cacheBackend->get("$key:$langcode")) {
$this->displayModeInfo[$display_type] = $cache->data;
}
......
......@@ -13,7 +13,7 @@
use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\Core\Field\FieldItemInterface;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Language\Language;
use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\Language\LanguageManagerInterface;
use Drupal\Core\TypedData\TranslatableInterface;
use Drupal\Core\Render\Element;
......@@ -109,7 +109,7 @@ public function view(EntityInterface $entity, $view_mode = 'full', $langcode = N
*/
public function viewMultiple(array $entities = array(), $view_mode = 'full', $langcode = NULL) {
if (!isset($langcode)) {
$langcode = $this->languageManager->getCurrentLanguage(Language::TYPE_CONTENT)->id;
$langcode = $this->languageManager->getCurrentLanguage(LanguageInterface::TYPE_CONTENT)->id;
}
$build_list = array(
......
......@@ -9,7 +9,6 @@
use Drupal\Core\Config\Config;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Language\Language;
use Drupal\Core\Language\LanguageManager;
use Drupal\Core\Site\Settings;
use Symfony\Component\HttpFoundation\Request;
......
......@@ -11,7 +11,7 @@
use Drupal\Core\TypedData\DataDefinitionInterface;
use Drupal\Core\TypedData\TypedDataInterface;
use Drupal\Core\TypedData\Plugin\DataType\ItemList;
use Drupal\Core\Language\Language;
use Drupal\Core\Language\LanguageInterface;
/**
* Represents an entity field; that is, a list of field item objects.
......@@ -36,7 +36,7 @@ class FieldItemList extends ItemList implements FieldItemListInterface {
*
* @var string
*/
protected $langcode = Language::LANGCODE_NOT_SPECIFIED;
protected $langcode = LanguageInterface::LANGCODE_NOT_SPECIFIED;
/**
* {@inheritdoc}
......
......@@ -9,7 +9,7 @@
use Drupal\Core\Field\FieldStorageDefinitionInterface;
use Drupal\Core\Field\FieldItemBase;
use Drupal\Core\Language\Language;
use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\TypedData\DataDefinition;
use Drupal\Core\TypedData\DataReferenceDefinition;
......@@ -92,7 +92,7 @@ public function setValue($values, $notify = TRUE) {
*/
public function applyDefaultValue($notify = TRUE) {
// Default to LANGCODE_NOT_SPECIFIED.
$this->setValue(array('value' => Language::LANGCODE_NOT_SPECIFIED), $notify);
$this->setValue(array('value' => LanguageInterface::LANGCODE_NOT_SPECIFIED), $notify);
return $this;
}
......
......@@ -22,7 +22,7 @@ class LanguageDefault {
/**
* The default language.
*
* @var \Drupal\Core\Language\Language
* @var \Drupal\Core\Language\LanguageInterface
*/
protected $language;
......@@ -39,7 +39,7 @@ public function __construct(array $values) {
/**
* Gets the default language.
*
* @return \Drupal\Core\Language\Language
* @return \Drupal\Core\Language\LanguageInterface
* The default language.
*/
public function get() {
......@@ -49,10 +49,10 @@ public function get() {
/**
* Sets the default language.
*
* @param \Drupal\Core\Language\Language $language
* @param \Drupal\Core\Language\LanguageInterface $language
* The default language.
*/
public function set(Language $language) {
public function set(LanguageInterface $language) {
$language->default = TRUE;
$this->language = $language;
}
......
......@@ -40,7 +40,7 @@ class LanguageManager extends DependencySerialization implements LanguageManager
/**
* Constructs the language manager.
*
* @param \Drupal\Core\Language\Language $default_language
* @param \Drupal\Core\Language\LanguageDefault $default_language
* The default language.
*/
public function __construct(LanguageDefault $default_language) {
......@@ -80,13 +80,13 @@ public function isMultilingual() {
* {@inheritdoc}
*/
public function getLanguageTypes() {
return array(Language::TYPE_INTERFACE, Language::TYPE_CONTENT, Language::TYPE_URL);
return array(LanguageInterface::TYPE_INTERFACE, LanguageInterface::TYPE_CONTENT, LanguageInterface::TYPE_URL);
}
/**
* {@inheritdoc}
*/
public function getCurrentLanguage($type = Language::TYPE_INTERFACE) {
public function getCurrentLanguage($type = LanguageInterface::TYPE_INTERFACE) {
return $this->getDefaultLanguage();
}
......@@ -107,7 +107,7 @@ public function getDefaultLanguage() {
/**
* {@inheritdoc}
*/
public function getLanguages($flags = Language::STATE_CONFIGURABLE) {
public function getLanguages($flags = LanguageInterface::STATE_CONFIGURABLE) {
// Initialize master language list.
if (!isset($this->languages)) {
// No language module, so use the default language only.
......@@ -123,7 +123,7 @@ public function getLanguages($flags = Language::STATE_CONFIGURABLE) {
$filtered_languages = array();
// Add the site's default language if flagged as allowed value.
if ($flags & Language::STATE_SITE_DEFAULT) {
if ($flags & LanguageInterface::STATE_SITE_DEFAULT) {
$default = isset($default) ? $default : $this->getDefaultLanguage();
// Rename the default language.
$default->name = $this->t("Site's default language (@lang_name)", array('@lang_name' => $default->name));
......@@ -131,7 +131,7 @@ public function getLanguages($flags = Language::STATE_CONFIGURABLE) {
}
foreach ($this->languages as $id => $language) {
if (($language->locked && ($flags & Language::STATE_LOCKED)) || (!$language->locked && ($flags & Language::STATE_CONFIGURABLE))) {
if (($language->locked && ($flags & LanguageInterface::STATE_LOCKED)) || (!$language->locked && ($flags & LanguageInterface::STATE_CONFIGURABLE))) {
$filtered_languages[$id] = $language;
}
}
......@@ -143,7 +143,7 @@ public function getLanguages($flags = Language::STATE_CONFIGURABLE) {
* {@inheritdoc}
*/
public function getLanguage($langcode) {
$languages = $this->getLanguages(Language::STATE_ALL);
$languages = $this->getLanguages(LanguageInterface::STATE_ALL);
return isset($languages[$langcode]) ? $languages[$langcode] : NULL;
}
......@@ -151,7 +151,7 @@ public function getLanguage($langcode) {
* {@inheritdoc}
*/
public function getLanguageName($langcode) {
if ($langcode == Language::LANGCODE_NOT_SPECIFIED) {
if ($langcode == LanguageInterface::LANGCODE_NOT_SPECIFIED) {
return $this->t('None');
}
if ($language = $this->getLanguage($langcode)) {
......@@ -173,14 +173,14 @@ public function getDefaultLockedLanguages($weight = 0) {
'default' => FALSE,
'locked' => TRUE,
);
$languages[Language::LANGCODE_NOT_SPECIFIED] = new Language(array(
'id' => Language::LANGCODE_NOT_SPECIFIED,
$languages[LanguageInterface::LANGCODE_NOT_SPECIFIED] = new Language(array(
'id' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
'name' => $this->t('Not specified'),
'weight' => ++$weight,
) + $locked_language);
$languages[Language::LANGCODE_NOT_APPLICABLE] = new Language(array(
'id' => Language::LANGCODE_NOT_APPLICABLE,
$languages[LanguageInterface::LANGCODE_NOT_APPLICABLE] = new Language(array(
'id' => LanguageInterface::LANGCODE_NOT_APPLICABLE,
'name' => $this->t('Not applicable'),
'weight' => ++$weight,
) + $locked_language);
......@@ -200,7 +200,7 @@ public function isLanguageLocked($langcode) {
* {@inheritdoc}
*/
public function getFallbackCandidates($langcode = NULL, array $context = array()) {
return array(Language::LANGCODE_DEFAULT);
return array(LanguageInterface::LANGCODE_DEFAULT);
}
/**
......@@ -235,7 +235,7 @@ public static function getStandardLanguageList() {
return array(
'af' => array('Afrikaans', 'Afrikaans'),
'am' => array('Amharic', 'አማርኛ'),
'ar' => array('Arabic', /* Left-to-right marker "‭" */ 'العربية', Language::DIRECTION_RTL),
'ar' => array('Arabic', /* Left-to-right marker "‭" */ 'العربية', LanguageInterface::DIRECTION_RTL),