diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc index 50dc8f3..7e82c23 100644 --- a/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -25,7 +25,7 @@ use Symfony\Component\DependencyInjection\Exception\RuntimeException as DependencyInjectionRuntimeException; 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; @@ -1822,7 +1822,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 +1832,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 +1847,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() diff --git a/core/includes/common.inc b/core/includes/common.inc index 65aef09..9ca4f59 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -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 = "\n"; $output .= ' ' . String::checkPlain($title) . "\n"; @@ -1797,7 +1797,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); diff --git a/core/includes/theme.inc b/core/includes/theme.inc index e44f13d..418c386 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -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; diff --git a/core/lib/Drupal/Core/Config/ConfigModuleOverridesEvent.php b/core/lib/Drupal/Core/Config/ConfigModuleOverridesEvent.php index 26692ea..a2c65d5 100644 --- a/core/lib/Drupal/Core/Config/ConfigModuleOverridesEvent.php +++ b/core/lib/Drupal/Core/Config/ConfigModuleOverridesEvent.php @@ -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() { diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php index 318ad7a..15eba92 100644 --- a/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php +++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php @@ -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 @@ * * @var string */ - public $langcode = Language::LANGCODE_NOT_SPECIFIED; + public $langcode = LanguageInterface::LANGCODE_NOT_SPECIFIED; /** * Overrides Entity::__construct(). diff --git a/core/lib/Drupal/Core/Entity/ContentEntityBase.php b/core/lib/Drupal/Core/Entity/ContentEntityBase.php index 1895cfd..3eb0e02 100644 --- a/core/lib/Drupal/Core/Entity/ContentEntityBase.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityBase.php @@ -10,7 +10,7 @@ use Drupal\Component\Utility\String; use Drupal\Core\Entity\Plugin\DataType\EntityReference; use Drupal\Core\Entity\TypedData\EntityDataDefinition; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Session\AccountInterface; use Drupal\Core\TypedData\TypedDataInterface; @@ -80,7 +80,7 @@ * * @var string */ - protected $activeLangcode = Language::LANGCODE_DEFAULT; + protected $activeLangcode = LanguageInterface::LANGCODE_DEFAULT; /** * Local cache for the default language code. @@ -141,22 +141,22 @@ public function __construct(array $values, $entity_type, $bundle = FALSE, $translations = array()) { $this->entityTypeId = $entity_type; $this->entityKeys['bundle'] = $bundle ? $bundle : $this->entityTypeId; - $this->languages = $this->languageManager()->getLanguages(Language::STATE_ALL); + $this->languages = $this->languageManager()->getLanguages(LanguageInterface::STATE_ALL); foreach ($values as $key => $value) { // If the key matches an existing property set the value to the property // to set properties like isDefaultRevision. // @todo: Should this be converted somehow? - if (property_exists($this, $key) && isset($value[Language::LANGCODE_DEFAULT])) { - $this->$key = $value[Language::LANGCODE_DEFAULT]; + if (property_exists($this, $key) && isset($value[LanguageInterface::LANGCODE_DEFAULT])) { + $this->$key = $value[LanguageInterface::LANGCODE_DEFAULT]; } } $this->values = $values; foreach ($this->getEntityType()->getKeys() as $key => $field_name) { if (isset($this->values[$field_name])) { - if (is_array($this->values[$field_name]) && isset($this->values[$field_name][Language::LANGCODE_DEFAULT])) { - $this->entityKeys[$key] = $this->values[$field_name][Language::LANGCODE_DEFAULT]; + if (is_array($this->values[$field_name]) && isset($this->values[$field_name][LanguageInterface::LANGCODE_DEFAULT])) { + $this->entityKeys[$key] = $this->values[$field_name][LanguageInterface::LANGCODE_DEFAULT]; } } } @@ -164,11 +164,11 @@ public function __construct(array $values, $entity_type, $bundle = FALSE, $trans // Initialize translations. Ensure we have at least an entry for the default // language. $data = array('status' => static::TRANSLATION_EXISTING); - $this->translations[Language::LANGCODE_DEFAULT] = $data; + $this->translations[LanguageInterface::LANGCODE_DEFAULT] = $data; $this->setDefaultLangcode(); if ($translations) { foreach ($translations as $langcode) { - if ($langcode != $this->defaultLangcode && $langcode != Language::LANGCODE_DEFAULT) { + if ($langcode != $this->defaultLangcode && $langcode != LanguageInterface::LANGCODE_DEFAULT) { $this->translations[$langcode] = $data; } } @@ -429,12 +429,12 @@ protected function getTranslatedField($name, $langcode) { // Non-translatable fields are always stored with // Language::LANGCODE_DEFAULT as key. - $default = $langcode == Language::LANGCODE_DEFAULT; + $default = $langcode == LanguageInterface::LANGCODE_DEFAULT; if (!$default && !$definition->isTranslatable()) { - if (!isset($this->fields[$name][Language::LANGCODE_DEFAULT])) { - $this->fields[$name][Language::LANGCODE_DEFAULT] = $this->getTranslatedField($name, Language::LANGCODE_DEFAULT); + if (!isset($this->fields[$name][LanguageInterface::LANGCODE_DEFAULT])) { + $this->fields[$name][LanguageInterface::LANGCODE_DEFAULT] = $this->getTranslatedField($name, LanguageInterface::LANGCODE_DEFAULT); } - $this->fields[$name][$langcode] = &$this->fields[$name][Language::LANGCODE_DEFAULT]; + $this->fields[$name][$langcode] = &$this->fields[$name][LanguageInterface::LANGCODE_DEFAULT]; } else { $value = NULL; @@ -446,7 +446,7 @@ protected function getTranslatedField($name, $langcode) { // $this->defaultLangcode might not be set if we are initializing the // default language code cache, in which case there is no valid // langcode to assign. - $field_langcode = isset($this->defaultLangcode) ? $this->defaultLangcode : Language::LANGCODE_NOT_SPECIFIED; + $field_langcode = isset($this->defaultLangcode) ? $this->defaultLangcode : LanguageInterface::LANGCODE_NOT_SPECIFIED; } else { $field_langcode = $langcode; @@ -554,9 +554,9 @@ public function access($operation, AccountInterface $account = NULL) { */ public function language() { $language = NULL; - if ($this->activeLangcode != Language::LANGCODE_DEFAULT) { + if ($this->activeLangcode != LanguageInterface::LANGCODE_DEFAULT) { if (!isset($this->languages[$this->activeLangcode])) { - $this->languages += $this->languageManager()->getLanguages(Language::STATE_ALL); + $this->languages += $this->languageManager()->getLanguages(LanguageInterface::STATE_ALL); } $language = $this->languages[$this->activeLangcode]; } @@ -576,25 +576,22 @@ protected function setDefaultLangcode() { } if (empty($this->defaultLangcode)) { // Make sure we return a proper language object. - $this->defaultLangcode = Language::LANGCODE_NOT_SPECIFIED; + $this->defaultLangcode = LanguageInterface::LANGCODE_NOT_SPECIFIED; } // This needs to be initialized manually as it is skipped when instantiating // the language field object to avoid infinite recursion. if (!empty($this->fields['langcode'])) { - $this->fields['langcode'][Language::LANGCODE_DEFAULT]->setLangcode($this->defaultLangcode); + $this->fields['langcode'][LanguageInterface::LANGCODE_DEFAULT]->setLangcode($this->defaultLangcode); } } /** * Updates language for already instantiated fields. - * - * @return \Drupal\Core\Language\Language - * A language object. */ protected function updateFieldLangcodes($langcode) { foreach ($this->fields as $name => $items) { - if (!empty($items[Language::LANGCODE_DEFAULT])) { - $items[Language::LANGCODE_DEFAULT]->setLangcode($langcode); + if (!empty($items[LanguageInterface::LANGCODE_DEFAULT])) { + $items[LanguageInterface::LANGCODE_DEFAULT]->setLangcode($langcode); } } } @@ -630,8 +627,8 @@ public function onChange($name) { public function getTranslation($langcode) { // Ensure we always use the default language code when dealing with the // original entity language. - if ($langcode != Language::LANGCODE_DEFAULT && $langcode == $this->defaultLangcode) { - $langcode = Language::LANGCODE_DEFAULT; + if ($langcode != LanguageInterface::LANGCODE_DEFAULT && $langcode == $this->defaultLangcode) { + $langcode = LanguageInterface::LANGCODE_DEFAULT; } // Populate entity translation object cache so it will be available for all @@ -674,7 +671,7 @@ public function getTranslation($langcode) { * {@inheritdoc} */ public function getUntranslated() { - return $this->getTranslation(Language::LANGCODE_DEFAULT); + return $this->getTranslation(LanguageInterface::LANGCODE_DEFAULT); } /** @@ -721,7 +718,7 @@ protected function initializeTranslation($langcode) { */ public function hasTranslation($langcode) { if ($langcode == $this->defaultLangcode) { - $langcode = Language::LANGCODE_DEFAULT; + $langcode = LanguageInterface::LANGCODE_DEFAULT; } return !empty($this->translations[$langcode]['status']); } @@ -766,7 +763,7 @@ public function addTranslation($langcode, array $values = array()) { * {@inheritdoc} */ public function removeTranslation($langcode) { - if (isset($this->translations[$langcode]) && $langcode != Language::LANGCODE_DEFAULT && $langcode != $this->defaultLangcode) { + if (isset($this->translations[$langcode]) && $langcode != LanguageInterface::LANGCODE_DEFAULT && $langcode != $this->defaultLangcode) { foreach ($this->getFieldDefinitions() as $name => $definition) { if ($definition->isTranslatable()) { unset($this->values[$name][$langcode]); @@ -785,7 +782,7 @@ public function removeTranslation($langcode) { * {@inheritdoc} */ public function initTranslation($langcode) { - if ($langcode != Language::LANGCODE_DEFAULT && $langcode != $this->defaultLangcode) { + if ($langcode != LanguageInterface::LANGCODE_DEFAULT && $langcode != $this->defaultLangcode) { $this->translations[$langcode]['status'] = static::TRANSLATION_EXISTING; } } @@ -795,7 +792,7 @@ public function initTranslation($langcode) { */ public function getTranslationLanguages($include_default = TRUE) { $translations = array_filter($this->translations, function($translation) { return $translation['status']; }); - unset($translations[Language::LANGCODE_DEFAULT]); + unset($translations[LanguageInterface::LANGCODE_DEFAULT]); if ($include_default) { $translations[$this->defaultLangcode] = TRUE; @@ -957,7 +954,7 @@ public function __clone() { // we retain just the original value, as references will be recreated // later as needed. if (!$definitions[$name]->isTranslatable() && count($values) > 1) { - $values = array_intersect_key($values, array(Language::LANGCODE_DEFAULT => TRUE)); + $values = array_intersect_key($values, array(LanguageInterface::LANGCODE_DEFAULT => TRUE)); } foreach ($values as $langcode => $items) { $this->fields[$name][$langcode] = clone $items; diff --git a/core/lib/Drupal/Core/Entity/ContentEntityDatabaseStorage.php b/core/lib/Drupal/Core/Entity/ContentEntityDatabaseStorage.php index 2214894..f42c091 100644 --- a/core/lib/Drupal/Core/Entity/ContentEntityDatabaseStorage.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityDatabaseStorage.php @@ -10,7 +10,7 @@ use Drupal\Core\Database\Connection; use Drupal\Core\Entity\Query\QueryInterface; 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; @@ -163,12 +163,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 @@ -209,7 +209,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); } @@ -229,7 +229,7 @@ protected function attachPropertyData(array &$entities) { // Field values in default language are stored with // Language::LANGCODE_DEFAULT as key. - $langcode = empty($values['default_langcode']) ? $values['langcode'] : Language::LANGCODE_DEFAULT; + $langcode = empty($values['default_langcode']) ? $values['langcode'] : LanguageInterface::LANGCODE_DEFAULT; $translations[$id][$langcode] = TRUE; foreach (array_keys($field_definitions) as $field_name) { @@ -255,7 +255,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])); } @@ -738,7 +738,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); diff --git a/core/lib/Drupal/Core/Entity/Entity.php b/core/lib/Drupal/Core/Entity/Entity.php index 557ddf3..8006477 100644 --- a/core/lib/Drupal/Core/Entity/Entity.php +++ b/core/lib/Drupal/Core/Entity/Entity.php @@ -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; } diff --git a/core/lib/Drupal/Core/Entity/EntityAccessController.php b/core/lib/Drupal/Core/Entity/EntityAccessController.php index b092914..f20ef9c 100644 --- a/core/lib/Drupal/Core/Entity/EntityAccessController.php +++ b/core/lib/Drupal/Core/Entity/EntityAccessController.php @@ -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'; diff --git a/core/lib/Drupal/Core/Entity/EntityAccessControllerInterface.php b/core/lib/Drupal/Core/Entity/EntityAccessControllerInterface.php index 6bc8a23..afab887 100644 --- a/core/lib/Drupal/Core/Entity/EntityAccessControllerInterface.php +++ b/core/lib/Drupal/Core/Entity/EntityAccessControllerInterface.php @@ -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; /** @@ -39,7 +39,7 @@ * @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. diff --git a/core/lib/Drupal/Core/Entity/EntityInterface.php b/core/lib/Drupal/Core/Entity/EntityInterface.php index 4a2f69c..3964492 100644 --- a/core/lib/Drupal/Core/Entity/EntityInterface.php +++ b/core/lib/Drupal/Core/Entity/EntityInterface.php @@ -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(); diff --git a/core/lib/Drupal/Core/Entity/EntityManager.php b/core/lib/Drupal/Core/Entity/EntityManager.php index 32c9aae..ce8eaee 100644 --- a/core/lib/Drupal/Core/Entity/EntityManager.php +++ b/core/lib/Drupal/Core/Entity/EntityManager.php @@ -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; @@ -710,7 +710,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 @@ -721,7 +721,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) { @@ -775,7 +775,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; } diff --git a/core/lib/Drupal/Core/Entity/EntityViewBuilder.php b/core/lib/Drupal/Core/Entity/EntityViewBuilder.php index cd1cbfb..71d3308 100644 --- a/core/lib/Drupal/Core/Entity/EntityViewBuilder.php +++ b/core/lib/Drupal/Core/Entity/EntityViewBuilder.php @@ -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( diff --git a/core/lib/Drupal/Core/Field/FieldItemList.php b/core/lib/Drupal/Core/Field/FieldItemList.php index 39be1ee..2e0b442 100644 --- a/core/lib/Drupal/Core/Field/FieldItemList.php +++ b/core/lib/Drupal/Core/Field/FieldItemList.php @@ -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} diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/LanguageItem.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/LanguageItem.php index e3192b2..719a0d6 100644 --- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/LanguageItem.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/LanguageItem.php @@ -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; } diff --git a/core/lib/Drupal/Core/Language/LanguageDefault.php b/core/lib/Drupal/Core/Language/LanguageDefault.php index a72b8b1..1ca8009 100644 --- a/core/lib/Drupal/Core/Language/LanguageDefault.php +++ b/core/lib/Drupal/Core/Language/LanguageDefault.php @@ -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; } diff --git a/core/lib/Drupal/Core/Language/LanguageManager.php b/core/lib/Drupal/Core/Language/LanguageManager.php index 3d943d0..d596853 100644 --- a/core/lib/Drupal/Core/Language/LanguageManager.php +++ b/core/lib/Drupal/Core/Language/LanguageManager.php @@ -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), 'ast' => array('Asturian', 'Asturianu'), 'az' => array('Azerbaijani', 'Azərbaycanca'), 'be' => array('Belarusian', 'Беларуская'), @@ -255,7 +255,7 @@ public static function getStandardLanguageList() { 'es' => array('Spanish', 'Español'), 'et' => array('Estonian', 'Eesti'), 'eu' => array('Basque', 'Euskera'), - 'fa' => array('Persian, Farsi', /* Left-to-right marker "‭" */ 'فارسی', Language::DIRECTION_RTL), + 'fa' => array('Persian, Farsi', /* Left-to-right marker "‭" */ 'فارسی', LanguageInterface::DIRECTION_RTL), 'fi' => array('Finnish', 'Suomi'), 'fil' => array('Filipino', 'Filipino'), 'fo' => array('Faeroese', 'Føroyskt'), @@ -266,7 +266,7 @@ public static function getStandardLanguageList() { 'gl' => array('Galician', 'Galego'), 'gsw-berne' => array('Swiss German', 'Schwyzerdütsch'), 'gu' => array('Gujarati', 'ગુજરાતી'), - 'he' => array('Hebrew', /* Left-to-right marker "‭" */ 'עברית', Language::DIRECTION_RTL), + 'he' => array('Hebrew', /* Left-to-right marker "‭" */ 'עברית', LanguageInterface::DIRECTION_RTL), 'hi' => array('Hindi', 'हिन्दी'), 'hr' => array('Croatian', 'Hrvatski'), 'ht' => array('Haitian Creole', 'Kreyòl ayisyen'), @@ -322,7 +322,7 @@ public static function getStandardLanguageList() { 'tyv' => array('Tuvan', 'Тыва дыл'), 'ug' => array('Uyghur', 'Уйғур'), 'uk' => array('Ukrainian', 'Українська'), - 'ur' => array('Urdu', /* Left-to-right marker "‭" */ 'اردو', Language::DIRECTION_RTL), + 'ur' => array('Urdu', /* Left-to-right marker "‭" */ 'اردو', LanguageInterface::DIRECTION_RTL), 'vi' => array('Vietnamese', 'Tiếng Việt'), 'xx-lolspeak' => array('Lolspeak', 'Lolspeak'), 'zh-hans' => array('Chinese, Simplified', '简体中文'), @@ -339,7 +339,7 @@ public static function getStandardLanguageList() { * * @see \Drupal\language\ConfigurableLanguageManager::setConfigOverrideLanguage() */ - public function setConfigOverrideLanguage(Language $language = NULL) { + public function setConfigOverrideLanguage(LanguageInterface $language = NULL) { return $this; } diff --git a/core/lib/Drupal/Core/Language/LanguageManagerInterface.php b/core/lib/Drupal/Core/Language/LanguageManagerInterface.php index 43b2f23..2869f3c 100644 --- a/core/lib/Drupal/Core/Language/LanguageManagerInterface.php +++ b/core/lib/Drupal/Core/Language/LanguageManagerInterface.php @@ -50,10 +50,10 @@ public function getLanguageTypes(); * (optional) The language type, e.g. the interface or the content language. * Defaults to \Drupal\Core\Language\Language::TYPE_INTERFACE. * - * @return \Drupal\Core\Language\Language + * @return \Drupal\Core\Language\LanguageInterface * A language object for the given type. */ - public function getCurrentLanguage($type = Language::TYPE_INTERFACE); + public function getCurrentLanguage($type = LanguageInterface::TYPE_INTERFACE); /** * Resets the given language type or all types if none specified. @@ -71,7 +71,7 @@ public function reset($type = NULL); /** * Returns a language object representing the site's default language. * - * @return \Drupal\Core\Language\Language + * @return \Drupal\Core\Language\LanguageInterface * A language object. */ public function getDefaultLanguage(); @@ -87,7 +87,7 @@ public function getDefaultLanguage(); * @return array * An associative array of languages, keyed by the language code. */ - public function getLanguages($flags = Language::STATE_CONFIGURABLE); + public function getLanguages($flags = LanguageInterface::STATE_CONFIGURABLE); /** * Returns a language object from the given language code. @@ -95,7 +95,7 @@ public function getLanguages($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. */ public function getLanguage($langcode); @@ -170,17 +170,17 @@ public function getLanguageSwitchLinks($type, $path); /** * Sets the configuration override language. * - * @param \Drupal\Core\Language\Language $language + * @param \Drupal\Core\Language\LanguageInterface $language * The language to override configuration with. * * @return $this */ - public function setConfigOverrideLanguage(Language $language = NULL); + public function setConfigOverrideLanguage(LanguageInterface $language = NULL); /** * Gets the current configuration override language. * - * @return \Drupal\Core\Language\Language $language + * @return \Drupal\Core\Language\LanguageInterface $language * The current configuration override language. */ public function getConfigOverrideLanguage(); diff --git a/core/lib/Drupal/Core/Path/AliasManager.php b/core/lib/Drupal/Core/Path/AliasManager.php index 55d2ddc..645e3b6 100644 --- a/core/lib/Drupal/Core/Path/AliasManager.php +++ b/core/lib/Drupal/Core/Path/AliasManager.php @@ -7,7 +7,7 @@ namespace Drupal\Core\Path; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Language\LanguageManager; class AliasManager implements AliasManagerInterface { @@ -95,7 +95,7 @@ public function getPathByAlias($alias, $langcode = NULL) { // language. If we used a language different from the one conveyed by the // requested URL, we might end up being unable to check if there is a path // alias matching the URL path. - $langcode = $langcode ?: $this->languageManager->getCurrentLanguage(Language::TYPE_URL)->id; + $langcode = $langcode ?: $this->languageManager->getCurrentLanguage(LanguageInterface::TYPE_URL)->id; // If we already know that there are no paths for this alias simply return. if (empty($alias) || !empty($this->noPath[$langcode][$alias])) { @@ -127,7 +127,7 @@ public function getAliasByPath($path, $langcode = NULL) { // language. If we used a language different from the one conveyed by the // requested URL, we might end up being unable to check if there is a path // alias matching the URL path. - $langcode = $langcode ?: $this->languageManager->getCurrentLanguage(Language::TYPE_URL)->id; + $langcode = $langcode ?: $this->languageManager->getCurrentLanguage(LanguageInterface::TYPE_URL)->id; // Check the path whitelist, if the top-level part before the first / // is not in the list, then there is no need to do anything further, diff --git a/core/lib/Drupal/Core/Path/AliasStorage.php b/core/lib/Drupal/Core/Path/AliasStorage.php index aa6989c..b405a25 100644 --- a/core/lib/Drupal/Core/Path/AliasStorage.php +++ b/core/lib/Drupal/Core/Path/AliasStorage.php @@ -9,7 +9,7 @@ use Drupal\Core\Database\Connection; use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; /** * Provides a class for CRUD operations on path aliases. @@ -46,7 +46,7 @@ public function __construct(Connection $connection, ModuleHandlerInterface $modu /** * {@inheritdoc} */ - public function save($source, $alias, $langcode = Language::LANGCODE_NOT_SPECIFIED, $pid = NULL) { + public function save($source, $alias, $langcode = LanguageInterface::LANGCODE_NOT_SPECIFIED, $pid = NULL) { $fields = array( 'source' => $source, @@ -114,7 +114,7 @@ public function preloadPathAlias($preloaded, $langcode) { $args = array( ':system' => $preloaded, ':langcode' => $langcode, - ':langcode_undetermined' => Language::LANGCODE_NOT_SPECIFIED, + ':langcode_undetermined' => LanguageInterface::LANGCODE_NOT_SPECIFIED, ); // Always get the language-specific alias before the language-neutral one. // For example 'de' is less than 'und' so the order needs to be ASC, while @@ -123,12 +123,12 @@ public function preloadPathAlias($preloaded, $langcode) { // created alias for each source. Subsequent queries using fetchField() must // use pid DESC to have the same effect. For performance reasons, the query // builder is not used here. - if ($langcode == Language::LANGCODE_NOT_SPECIFIED) { + if ($langcode == LanguageInterface::LANGCODE_NOT_SPECIFIED) { // Prevent PDO from complaining about a token the query doesn't use. unset($args[':langcode']); $result = $this->connection->query('SELECT source, alias FROM {url_alias} WHERE source IN (:system) AND langcode = :langcode_undetermined ORDER BY pid ASC', $args); } - elseif ($langcode < Language::LANGCODE_NOT_SPECIFIED) { + elseif ($langcode < LanguageInterface::LANGCODE_NOT_SPECIFIED) { $result = $this->connection->query('SELECT source, alias FROM {url_alias} WHERE source IN (:system) AND langcode IN (:langcode, :langcode_undetermined) ORDER BY langcode ASC, pid ASC', $args); } else { @@ -145,14 +145,14 @@ public function lookupPathAlias($path, $langcode) { $args = array( ':source' => $path, ':langcode' => $langcode, - ':langcode_undetermined' => Language::LANGCODE_NOT_SPECIFIED, + ':langcode_undetermined' => LanguageInterface::LANGCODE_NOT_SPECIFIED, ); // See the queries above. - if ($langcode == Language::LANGCODE_NOT_SPECIFIED) { + if ($langcode == LanguageInterface::LANGCODE_NOT_SPECIFIED) { unset($args[':langcode']); $alias = $this->connection->query("SELECT alias FROM {url_alias} WHERE source = :source AND langcode = :langcode_undetermined ORDER BY pid DESC", $args)->fetchField(); } - elseif ($langcode > Language::LANGCODE_NOT_SPECIFIED) { + elseif ($langcode > LanguageInterface::LANGCODE_NOT_SPECIFIED) { $alias = $this->connection->query("SELECT alias FROM {url_alias} WHERE source = :source AND langcode IN (:langcode, :langcode_undetermined) ORDER BY langcode DESC, pid DESC", $args)->fetchField(); } else { @@ -169,14 +169,14 @@ public function lookupPathSource($path, $langcode) { $args = array( ':alias' => $path, ':langcode' => $langcode, - ':langcode_undetermined' => Language::LANGCODE_NOT_SPECIFIED, + ':langcode_undetermined' => LanguageInterface::LANGCODE_NOT_SPECIFIED, ); // See the queries above. - if ($langcode == Language::LANGCODE_NOT_SPECIFIED) { + if ($langcode == LanguageInterface::LANGCODE_NOT_SPECIFIED) { unset($args[':langcode']); $result = $this->connection->query("SELECT source FROM {url_alias} WHERE alias = :alias AND langcode = :langcode_undetermined ORDER BY pid DESC", $args); } - elseif ($langcode > Language::LANGCODE_NOT_SPECIFIED) { + elseif ($langcode > LanguageInterface::LANGCODE_NOT_SPECIFIED) { $result = $this->connection->query("SELECT source FROM {url_alias} WHERE alias = :alias AND langcode IN (:langcode, :langcode_undetermined) ORDER BY langcode DESC, pid DESC", $args); } else { @@ -217,7 +217,7 @@ public function aliasExists($alias, $langcode, $source = NULL) { * TRUE if aliases with language exist. */ public function languageAliasExists() { - return (bool) $this->connection->queryRange('SELECT 1 FROM {url_alias} WHERE langcode <> :langcode', 0, 1, array(':langcode' => Language::LANGCODE_NOT_SPECIFIED))->fetchField(); + return (bool) $this->connection->queryRange('SELECT 1 FROM {url_alias} WHERE langcode <> :langcode', 0, 1, array(':langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED))->fetchField(); } /** diff --git a/core/lib/Drupal/Core/Path/AliasStorageInterface.php b/core/lib/Drupal/Core/Path/AliasStorageInterface.php index 68c7cdd..a98600f 100644 --- a/core/lib/Drupal/Core/Path/AliasStorageInterface.php +++ b/core/lib/Drupal/Core/Path/AliasStorageInterface.php @@ -7,7 +7,7 @@ namespace Drupal\Core\Path; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; /** * Provides a class for CRUD operations on path aliases. @@ -34,7 +34,7 @@ * - pid (int): Unique path alias identifier. * - langcode (string): The language code of the alias. */ - public function save($source, $alias, $langcode = Language::LANGCODE_NOT_SPECIFIED, $pid = NULL); + public function save($source, $alias, $langcode = LanguageInterface::LANGCODE_NOT_SPECIFIED, $pid = NULL); /** * Fetches a specific URL alias from the database. diff --git a/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php b/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php index 2016a18..6ee6389 100644 --- a/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php +++ b/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php @@ -18,7 +18,6 @@ use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Language\LanguageManagerInterface; -use Drupal\Core\Language\Language; use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery; use Drupal\Core\Plugin\Factory\ContainerFactory; diff --git a/core/lib/Drupal/Core/Utility/Token.php b/core/lib/Drupal/Core/Utility/Token.php index 4a1238e..d03d645 100644 --- a/core/lib/Drupal/Core/Utility/Token.php +++ b/core/lib/Drupal/Core/Utility/Token.php @@ -9,7 +9,7 @@ use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Language\LanguageManagerInterface; /** @@ -311,7 +311,7 @@ public function findWithPrefix(array $tokens, $prefix, $delimiter = ':') { */ public function getInfo() { if (is_null($this->tokenInfo)) { - $cache_id = 'token_info:' . $this->languageManager->getCurrentLanguage(Language::TYPE_CONTENT)->id; + $cache_id = 'token_info:' . $this->languageManager->getCurrentLanguage(LanguageInterface::TYPE_CONTENT)->id; $cache = $this->cache->get($cache_id); if ($cache) { $this->tokenInfo = $cache->data; diff --git a/core/lib/Drupal/Core/Validation/DrupalTranslator.php b/core/lib/Drupal/Core/Validation/DrupalTranslator.php index 5b4d99d..01302ce 100644 --- a/core/lib/Drupal/Core/Validation/DrupalTranslator.php +++ b/core/lib/Drupal/Core/Validation/DrupalTranslator.php @@ -7,7 +7,6 @@ namespace Drupal\Core\Validation; -use Drupal\Core\Language\Language; use Symfony\Component\Translation\TranslatorInterface; /** diff --git a/core/modules/aggregator/aggregator.install b/core/modules/aggregator/aggregator.install index e4bef0e..028f8cd 100644 --- a/core/modules/aggregator/aggregator.install +++ b/core/modules/aggregator/aggregator.install @@ -4,7 +4,6 @@ * @file * Install, update and uninstall functions for the aggregator module. */ -use Drupal\Core\Language\Language; /** * Implements hook_requirements(). diff --git a/core/modules/aggregator/lib/Drupal/aggregator/FeedForm.php b/core/modules/aggregator/lib/Drupal/aggregator/FeedForm.php index 1770f03..d13274f 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/FeedForm.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/FeedForm.php @@ -10,7 +10,7 @@ use Drupal\Component\Utility\String; use Drupal\Core\Entity\ContentEntityForm; use Drupal\Core\Entity\EntityManagerInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** @@ -31,7 +31,7 @@ public function form(array $form, array &$form_state) { '#title' => $this->t('Language'), '#type' => 'language_select', '#default_value' => $feed->language()->id, - '#languages' => Language::STATE_ALL, + '#languages' => LanguageInterface::STATE_ALL, '#weight' => -4, ); diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Tests/AggregatorTestBase.php b/core/modules/aggregator/lib/Drupal/aggregator/Tests/AggregatorTestBase.php index f8df38a..de0cd6a 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/Tests/AggregatorTestBase.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/Tests/AggregatorTestBase.php @@ -8,7 +8,6 @@ namespace Drupal\aggregator\Tests; use Drupal\aggregator\Entity\Feed; -use Drupal\Core\Language\Language; use Drupal\simpletest\WebTestBase; use Drupal\aggregator\FeedInterface; diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockForm.php b/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockForm.php index f495c4f..aa668d8 100644 --- a/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockForm.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockForm.php @@ -11,7 +11,7 @@ use Drupal\Core\Entity\ContentEntityForm; use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Entity\EntityStorageInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Language\LanguageManager; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -110,7 +110,7 @@ public function form(array $form, array &$form_state) { '#title' => $this->t('Language'), '#type' => 'language_select', '#default_value' => $block->getUntranslated()->language()->id, - '#languages' => Language::STATE_ALL, + '#languages' => LanguageInterface::STATE_ALL, '#access' => isset($language_configuration['language_show']) && $language_configuration['language_show'], ); diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/PageEditTest.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/PageEditTest.php index 8062fb5..e39c81f 100644 --- a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/PageEditTest.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/PageEditTest.php @@ -7,8 +7,6 @@ namespace Drupal\custom_block\Tests; -use Drupal\Core\Language\Language; - /** * Tests the block edit functionality. */ diff --git a/core/modules/block/lib/Drupal/block/BlockBase.php b/core/modules/block/lib/Drupal/block/BlockBase.php index 68f5f36..e876209 100644 --- a/core/modules/block/lib/Drupal/block/BlockBase.php +++ b/core/modules/block/lib/Drupal/block/BlockBase.php @@ -11,7 +11,7 @@ use Drupal\block\BlockInterface; use Drupal\Component\Utility\Unicode; use Drupal\Component\Utility\NestedArray; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Cache\Cache; use Drupal\Core\Cache\CacheableInterface; use Drupal\Core\Session\AccountInterface; @@ -262,7 +262,7 @@ public function getMachineNameSuggestion() { // \Drupal\system\MachineNameController::transliterate(), so it might make // sense to provide a common service for the two. $transliteration_service = \Drupal::transliteration(); - $transliterated = $transliteration_service->transliterate($admin_label, Language::LANGCODE_DEFAULT, '_'); + $transliterated = $transliteration_service->transliterate($admin_label, LanguageInterface::LANGCODE_DEFAULT, '_'); $replace_pattern = '[^a-z0-9_.]+'; diff --git a/core/modules/block/lib/Drupal/block/BlockForm.php b/core/modules/block/lib/Drupal/block/BlockForm.php index 1249dab..866f1b8 100644 --- a/core/modules/block/lib/Drupal/block/BlockForm.php +++ b/core/modules/block/lib/Drupal/block/BlockForm.php @@ -10,7 +10,7 @@ use Drupal\Core\Cache\Cache; use Drupal\Core\Entity\EntityForm; use Drupal\Core\Entity\EntityManagerInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Language\LanguageManagerInterface; use Drupal\language\ConfigurableLanguageManagerInterface; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -157,7 +157,7 @@ public function form(array $form, array &$form_state) { $language_types = $this->languageManager->getLanguageTypes(); // Fetch languages. - $languages = $this->languageManager->getLanguages(Language::STATE_ALL); + $languages = $this->languageManager->getLanguages(LanguageInterface::STATE_ALL); $langcodes_options = array(); foreach ($languages as $language) { // @todo $language->name is not wrapped with t(), it should be replaced diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockLanguageCacheTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockLanguageCacheTest.php index 8fee2e2..baf080a 100644 --- a/core/modules/block/lib/Drupal/block/Tests/BlockLanguageCacheTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/BlockLanguageCacheTest.php @@ -8,8 +8,8 @@ namespace Drupal\block\Tests; use Drupal\Component\Utility\Unicode; -use Drupal\Core\Language\Language; use Drupal\simpletest\WebTestBase; +use Drupal\Core\Language\Language; /** * Tests multilingual block definition caching. diff --git a/core/modules/book/book.module b/core/modules/book/book.module index 9cc4835..5f11fba 100644 --- a/core/modules/book/book.module +++ b/core/modules/book/book.module @@ -11,7 +11,7 @@ use Drupal\Core\Render\Element; use Drupal\node\NodeInterface; use Drupal\node\NodeTypeInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Entity\Display\EntityViewDisplayInterface; use Drupal\Core\Template\Attribute; use Symfony\Component\HttpFoundation\Request; @@ -491,7 +491,7 @@ function template_preprocess_book_export_html(&$variables) { $variables['title'] = String::checkPlain($variables['title']); $variables['base_url'] = $base_url; $variables['language'] = $language_interface; - $variables['language_rtl'] = ($language_interface->direction == Language::DIRECTION_RTL); + $variables['language_rtl'] = ($language_interface->direction == LanguageInterface::DIRECTION_RTL); $variables['head'] = drupal_get_html_head(); // HTML element attributes. diff --git a/core/modules/ckeditor/ckeditor.admin.inc b/core/modules/ckeditor/ckeditor.admin.inc index 373ebd2..09a07a8 100644 --- a/core/modules/ckeditor/ckeditor.admin.inc +++ b/core/modules/ckeditor/ckeditor.admin.inc @@ -5,7 +5,6 @@ * Callbacks and theming for the CKEditor toolbar configuration UI. */ -use Drupal\Core\Language\Language; use Drupal\Core\Template\Attribute; /** diff --git a/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/Editor/CKEditor.php b/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/Editor/CKEditor.php index cc6af2f..e130737 100644 --- a/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/Editor/CKEditor.php +++ b/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/Editor/CKEditor.php @@ -10,7 +10,6 @@ use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\ckeditor\CKEditorPluginManager; -use Drupal\Core\Language\Language; use Drupal\Core\Language\LanguageManager; use Drupal\Core\Render\Element; use Drupal\editor\Plugin\EditorBase; diff --git a/core/modules/comment/lib/Drupal/comment/CommentForm.php b/core/modules/comment/lib/Drupal/comment/CommentForm.php index 6fd7ff6..1e9a241 100644 --- a/core/modules/comment/lib/Drupal/comment/CommentForm.php +++ b/core/modules/comment/lib/Drupal/comment/CommentForm.php @@ -14,7 +14,7 @@ use Drupal\Core\Datetime\DrupalDateTime; use Drupal\Core\Entity\ContentEntityForm; use Drupal\Core\Entity\EntityManagerInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Session\AccountInterface; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -64,7 +64,7 @@ protected function init(array &$form_state) { // Make the comment inherit the current content language unless specifically // set. if ($comment->isNew()) { - $language_content = \Drupal::languageManager()->getCurrentLanguage(Language::TYPE_CONTENT); + $language_content = \Drupal::languageManager()->getCurrentLanguage(LanguageInterface::TYPE_CONTENT); $comment->langcode->value = $language_content->id; } diff --git a/core/modules/comment/lib/Drupal/comment/CommentViewBuilder.php b/core/modules/comment/lib/Drupal/comment/CommentViewBuilder.php index 5a75d43..b79a088 100644 --- a/core/modules/comment/lib/Drupal/comment/CommentViewBuilder.php +++ b/core/modules/comment/lib/Drupal/comment/CommentViewBuilder.php @@ -15,7 +15,6 @@ use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Entity\EntityViewBuilder; use Drupal\entity\Entity\EntityViewDisplay; -use Drupal\Core\Language\Language; use Drupal\Core\Language\LanguageManagerInterface; use Symfony\Component\DependencyInjection\ContainerInterface; diff --git a/core/modules/comment/lib/Drupal/comment/Entity/Comment.php b/core/modules/comment/lib/Drupal/comment/Entity/Comment.php index de10346..3eb2a7b 100644 --- a/core/modules/comment/lib/Drupal/comment/Entity/Comment.php +++ b/core/modules/comment/lib/Drupal/comment/Entity/Comment.php @@ -13,7 +13,6 @@ use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Field\FieldDefinition; -use Drupal\Core\Language\Language; use Drupal\Core\TypedData\DataDefinition; use Drupal\user\UserInterface; diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentCSSTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentCSSTest.php index 8c2df9b..8c34754 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentCSSTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentCSSTest.php @@ -7,7 +7,7 @@ namespace Drupal\comment\Tests; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\comment\CommentInterface; /** @@ -59,8 +59,8 @@ function testCommentClasses() { 'uid' => $case['comment_uid'], 'status' => $case['comment_status'], 'subject' => $this->randomName(), - 'language' => Language::LANGCODE_NOT_SPECIFIED, - 'comment_body' => array(Language::LANGCODE_NOT_SPECIFIED => array($this->randomName())), + 'language' => LanguageInterface::LANGCODE_NOT_SPECIFIED, + 'comment_body' => array(LanguageInterface::LANGCODE_NOT_SPECIFIED => array($this->randomName())), )); $comment->save(); diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentLinksTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentLinksTest.php index cf7af82..bce2746 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentLinksTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentLinksTest.php @@ -8,7 +8,7 @@ namespace Drupal\comment\Tests; use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\comment\CommentInterface; /** @@ -152,8 +152,8 @@ function setEnvironment(array $info) { 'status' => CommentInterface::PUBLISHED, 'subject' => $this->randomName(), 'hostname' => '127.0.0.1', - 'langcode' => Language::LANGCODE_NOT_SPECIFIED, - 'comment_body' => array(Language::LANGCODE_NOT_SPECIFIED => array($this->randomName())), + 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, + 'comment_body' => array(LanguageInterface::LANGCODE_NOT_SPECIFIED => array($this->randomName())), )); $comment->save(); $this->comment = $comment; diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentNewIndicatorTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentNewIndicatorTest.php index fbe36d2..f955b62 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentNewIndicatorTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentNewIndicatorTest.php @@ -8,7 +8,7 @@ namespace Drupal\comment\Tests; use Drupal\Component\Serialization\Json; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\comment\CommentInterface; /** @@ -100,8 +100,8 @@ public function testCommentNewCommentsIndicator() { 'status' => CommentInterface::PUBLISHED, 'subject' => $this->randomName(), 'hostname' => '127.0.0.1', - 'langcode' => Language::LANGCODE_NOT_SPECIFIED, - 'comment_body' => array(Language::LANGCODE_NOT_SPECIFIED => array($this->randomName())), + 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, + 'comment_body' => array(LanguageInterface::LANGCODE_NOT_SPECIFIED => array($this->randomName())), )); $comment->save(); $this->drupalLogout(); diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentTestBase.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentTestBase.php index c1edf13..29f2033 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentTestBase.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentTestBase.php @@ -7,7 +7,6 @@ namespace Drupal\comment\Tests; -use Drupal\Core\Language\Language; use Drupal\comment\CommentInterface; use Drupal\simpletest\WebTestBase; diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentThreadingTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentThreadingTest.php index f69b55f..f0d7703 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentThreadingTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentThreadingTest.php @@ -7,8 +7,6 @@ namespace Drupal\comment\Tests; -use Drupal\Core\Language\Language; - /** * Tests comment threading. */ diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentTokenReplaceTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentTokenReplaceTest.php index 0d2a4b2..4a7b908 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentTokenReplaceTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentTokenReplaceTest.php @@ -8,7 +8,6 @@ namespace Drupal\comment\Tests; use Drupal\Component\Utility\Xss; -use Drupal\Core\Language\Language; /** * Tests comment token replacement in strings. diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigEntityTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigEntityTest.php index f3ca94f..fc079f4 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigEntityTest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigEntityTest.php @@ -12,7 +12,6 @@ use Drupal\Core\Entity\EntityStorageException; use Drupal\Core\Config\Entity\ConfigEntityStorage; use Drupal\Core\Config\Entity\Exception\ConfigEntityIdLengthException; -use Drupal\Core\Language\Language; use Drupal\simpletest\WebTestBase; /** diff --git a/core/modules/config/tests/config_test/lib/Drupal/config_test/ConfigTestAccessController.php b/core/modules/config/tests/config_test/lib/Drupal/config_test/ConfigTestAccessController.php index cec5421..fee7966 100644 --- a/core/modules/config/tests/config_test/lib/Drupal/config_test/ConfigTestAccessController.php +++ b/core/modules/config/tests/config_test/lib/Drupal/config_test/ConfigTestAccessController.php @@ -10,7 +10,6 @@ use Drupal\Core\Session\AccountInterface; use Drupal\Core\Entity\EntityAccessController; use Drupal\Core\Entity\EntityInterface; -use Drupal\Core\Language\Language; /** * Defines the access controller for the config_test entity type. diff --git a/core/modules/config_translation/lib/Drupal/config_translation/ConfigMapperInterface.php b/core/modules/config_translation/lib/Drupal/config_translation/ConfigMapperInterface.php index 28fb744..d12e7d0 100644 --- a/core/modules/config_translation/lib/Drupal/config_translation/ConfigMapperInterface.php +++ b/core/modules/config_translation/lib/Drupal/config_translation/ConfigMapperInterface.php @@ -7,7 +7,7 @@ namespace Drupal\config_translation; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\RouteCollection; @@ -269,14 +269,14 @@ public function hasTranslatable(); /** * Checks whether there is already a translation for this mapper. * - * @param \Drupal\Core\Language\Language $language + * @param \Drupal\Core\Language\LanguageInterface $language * A language object. * * @return bool * TRUE if any of the configuration elements have a translation in the * given language, FALSE otherwise. */ - public function hasTranslation(Language $language); + public function hasTranslation(LanguageInterface $language); /** * Populate the config mapper with request data. diff --git a/core/modules/config_translation/lib/Drupal/config_translation/ConfigNamesMapper.php b/core/modules/config_translation/lib/Drupal/config_translation/ConfigNamesMapper.php index ce935f4..2e59b70 100644 --- a/core/modules/config_translation/lib/Drupal/config_translation/ConfigNamesMapper.php +++ b/core/modules/config_translation/lib/Drupal/config_translation/ConfigNamesMapper.php @@ -9,6 +9,7 @@ use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Plugin\PluginBase; use Drupal\Core\Routing\RouteProviderInterface; use Drupal\Core\StringTranslation\TranslationInterface; @@ -432,7 +433,7 @@ public function hasTranslatable() { /** * {@inheritdoc} */ - public function hasTranslation(Language $language) { + public function hasTranslation(LanguageInterface $language) { foreach ($this->getConfigNames() as $name) { if ($this->localeConfigManager->hasTranslation($name, $language)) { return TRUE; diff --git a/core/modules/config_translation/lib/Drupal/config_translation/Form/ConfigTranslationFormBase.php b/core/modules/config_translation/lib/Drupal/config_translation/Form/ConfigTranslationFormBase.php index 13311d9..63b14eb 100644 --- a/core/modules/config_translation/lib/Drupal/config_translation/Form/ConfigTranslationFormBase.php +++ b/core/modules/config_translation/lib/Drupal/config_translation/Form/ConfigTranslationFormBase.php @@ -16,6 +16,7 @@ use Drupal\Core\Form\FormBase; use Drupal\Core\Language\Language; use Drupal\language\Config\LanguageConfigOverride; +use Drupal\Core\Language\LanguageInterface; use Drupal\language\ConfigurableLanguageManagerInterface; use Drupal\locale\StringStorageInterface; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -72,7 +73,7 @@ /** * The language of the configuration translation. * - * @var \Drupal\Core\Language\Language + * @var \Drupal\Core\Language\LanguageInterface */ protected $language; @@ -373,7 +374,7 @@ protected function buildConfigForm(Element $schema, $config_data, $base_config_d * @return array * Translation configuration override data. */ - protected function setConfig(Language $language, Config $base_config, LanguageConfigOverride $config_translation, array $config_values, $shipped_config = FALSE) { + protected function setConfig(LanguageInterface $language, Config $base_config, LanguageConfigOverride $config_translation, array $config_values, $shipped_config = FALSE) { foreach ($config_values as $key => $value) { if (is_array($value) && !isset($value['translation'])) { // Traverse into this level in the configuration. diff --git a/core/modules/config_translation/lib/Drupal/config_translation/FormElement/DateFormat.php b/core/modules/config_translation/lib/Drupal/config_translation/FormElement/DateFormat.php index 3abb57e..18b9666 100644 --- a/core/modules/config_translation/lib/Drupal/config_translation/FormElement/DateFormat.php +++ b/core/modules/config_translation/lib/Drupal/config_translation/FormElement/DateFormat.php @@ -10,7 +10,7 @@ use Drupal\Component\Utility\NestedArray; use Drupal\Core\Ajax\AjaxResponse; use Drupal\Core\Ajax\ReplaceCommand; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\StringTranslation\StringTranslationTrait; /** @@ -22,7 +22,7 @@ class DateFormat implements ElementInterface { /** * {@inheritdoc} */ - public function getFormElement(array $definition, Language $language, $value) { + public function getFormElement(array $definition, LanguageInterface $language, $value) { if (class_exists('intlDateFormatter')) { $description = $this->t('A user-defined date format. See the PHP manual for available options.', array('@url' => 'http://userguide.icu-project.org/formatparse/datetime')); } diff --git a/core/modules/config_translation/lib/Drupal/config_translation/FormElement/ElementInterface.php b/core/modules/config_translation/lib/Drupal/config_translation/FormElement/ElementInterface.php index 9072cfc..ecc93f0 100644 --- a/core/modules/config_translation/lib/Drupal/config_translation/FormElement/ElementInterface.php +++ b/core/modules/config_translation/lib/Drupal/config_translation/FormElement/ElementInterface.php @@ -7,7 +7,7 @@ namespace Drupal\config_translation\FormElement; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; /** * Provides an interface for configuration translation form elements. @@ -19,7 +19,7 @@ * * @param array $definition * Configuration schema type definition of the element. - * @param \Drupal\Core\Language\Language $language + * @param \Drupal\Core\Language\LanguageInterface $language * Language object to display the translation form for. * @param string $value * Default value for the form element. @@ -27,6 +27,6 @@ * @return array * Form API array to represent the form element. */ - public function getFormElement(array $definition, Language $language, $value); + public function getFormElement(array $definition, LanguageInterface $language, $value); } diff --git a/core/modules/config_translation/lib/Drupal/config_translation/FormElement/Textarea.php b/core/modules/config_translation/lib/Drupal/config_translation/FormElement/Textarea.php index b796685..63aecf3 100644 --- a/core/modules/config_translation/lib/Drupal/config_translation/FormElement/Textarea.php +++ b/core/modules/config_translation/lib/Drupal/config_translation/FormElement/Textarea.php @@ -7,7 +7,7 @@ namespace Drupal\config_translation\FormElement; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\StringTranslation\StringTranslationTrait; /** @@ -19,7 +19,7 @@ class Textarea implements ElementInterface { /** * {@inheritdoc} */ - public function getFormElement(array $definition, Language $language, $value) { + public function getFormElement(array $definition, LanguageInterface $language, $value) { // Estimate a comfortable size of the input textarea. $rows_words = ceil(str_word_count($value) / 5); $rows_newlines = substr_count($value, "\n" ) + 1; diff --git a/core/modules/config_translation/lib/Drupal/config_translation/FormElement/Textfield.php b/core/modules/config_translation/lib/Drupal/config_translation/FormElement/Textfield.php index 46d71fe..44105ba 100644 --- a/core/modules/config_translation/lib/Drupal/config_translation/FormElement/Textfield.php +++ b/core/modules/config_translation/lib/Drupal/config_translation/FormElement/Textfield.php @@ -7,7 +7,7 @@ namespace Drupal\config_translation\FormElement; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\StringTranslation\StringTranslationTrait; /** @@ -19,7 +19,7 @@ class Textfield implements ElementInterface { /** * {@inheritdoc} */ - public function getFormElement(array $definition, Language $language, $value) { + public function getFormElement(array $definition, LanguageInterface $language, $value) { return array( '#type' => 'textfield', '#default_value' => $value, diff --git a/core/modules/config_translation/lib/Drupal/config_translation/Tests/ConfigTranslationUiTest.php b/core/modules/config_translation/lib/Drupal/config_translation/Tests/ConfigTranslationUiTest.php index 46ef47f..ced73ab 100644 --- a/core/modules/config_translation/lib/Drupal/config_translation/Tests/ConfigTranslationUiTest.php +++ b/core/modules/config_translation/lib/Drupal/config_translation/Tests/ConfigTranslationUiTest.php @@ -11,6 +11,7 @@ use Drupal\Component\Utility\Unicode; use Drupal\Core\Config\FileStorage; use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\simpletest\WebTestBase; /** @@ -494,7 +495,7 @@ public function testSourceAndTargetLanguage() { $this->container ->get('config.factory') ->get('system.site') - ->set('langcode', Language::LANGCODE_NOT_SPECIFIED) + ->set('langcode', LanguageInterface::LANGCODE_NOT_SPECIFIED) ->save(); // Make sure translation tab does not exist on the configuration page. diff --git a/core/modules/config_translation/tests/Drupal/config_translation/Tests/ConfigMapperManagerTest.php b/core/modules/config_translation/tests/Drupal/config_translation/Tests/ConfigMapperManagerTest.php index 860941b..dd51300 100644 --- a/core/modules/config_translation/tests/Drupal/config_translation/Tests/ConfigMapperManagerTest.php +++ b/core/modules/config_translation/tests/Drupal/config_translation/Tests/ConfigMapperManagerTest.php @@ -9,6 +9,7 @@ use Drupal\config_translation\ConfigMapperManager; use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\TypedData\TypedDataInterface; use Drupal\Tests\UnitTestCase; @@ -50,7 +51,7 @@ public function setUp() { $language_manager = $this->getMock('Drupal\Core\Language\LanguageManagerInterface'); $language_manager->expects($this->once()) ->method('getCurrentLanguage') - ->with(Language::TYPE_INTERFACE) + ->with(LanguageInterface::TYPE_INTERFACE) ->will($this->returnValue($language)); $this->typedConfigManager = $this->getMockBuilder('Drupal\Core\Config\TypedConfigManager') diff --git a/core/modules/contact/lib/Drupal/contact/MessageForm.php b/core/modules/contact/lib/Drupal/contact/MessageForm.php index 401291e..5a98c86 100644 --- a/core/modules/contact/lib/Drupal/contact/MessageForm.php +++ b/core/modules/contact/lib/Drupal/contact/MessageForm.php @@ -11,7 +11,6 @@ use Drupal\Core\Entity\ContentEntityForm; use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Flood\FloodInterface; -use Drupal\Core\Language\Language; use Drupal\user\UserInterface; use Symfony\Component\DependencyInjection\ContainerInterface; diff --git a/core/modules/content_translation/content_translation.admin.inc b/core/modules/content_translation/content_translation.admin.inc index eb03aea..d2a3e1e 100644 --- a/core/modules/content_translation/content_translation.admin.inc +++ b/core/modules/content_translation/content_translation.admin.inc @@ -7,7 +7,7 @@ use Drupal\Component\Utility\String; use Drupal\Core\Field\FieldDefinitionInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Render\Element; use Drupal\field\Entity\FieldConfig; use Drupal\field\FieldInstanceConfigInterface; @@ -278,7 +278,7 @@ function content_translation_form_language_content_settings_validate(array $form $values = $bundle_settings['settings']['language']; if (empty($values['language_show']) && \Drupal::languageManager()->isLanguageLocked($values['langcode'])) { - foreach (\Drupal::languageManager()->getLanguages(Language::STATE_LOCKED) as $language) { + foreach (\Drupal::languageManager()->getLanguages(LanguageInterface::STATE_LOCKED) as $language) { $locked_languages[] = $language->name; } form_set_error($name, $form_state, t('Translation is not supported if language is always one of: @locked_languages', array('@locked_languages' => implode(', ', $locked_languages)))); diff --git a/core/modules/content_translation/content_translation.install b/core/modules/content_translation/content_translation.install index f6dda75..383d043 100644 --- a/core/modules/content_translation/content_translation.install +++ b/core/modules/content_translation/content_translation.install @@ -6,7 +6,7 @@ */ use Drupal\Core\Entity\EntityTypeInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUrl; /** @@ -87,7 +87,7 @@ function content_translation_install() { // Assign a fairly low weight to ensure our implementation of // hook_module_implements_alter() is run among the last ones. module_set_weight('content_translation', 10); - \Drupal::service('language_negotiator')->saveConfiguration(Language::TYPE_CONTENT, array(LanguageNegotiationUrl::METHOD_ID => 0)); + \Drupal::service('language_negotiator')->saveConfiguration(LanguageInterface::TYPE_CONTENT, array(LanguageNegotiationUrl::METHOD_ID => 0)); $config_names = \Drupal::configFactory()->listAll('field.field.'); foreach ($config_names as $name) { diff --git a/core/modules/content_translation/content_translation.module b/core/modules/content_translation/content_translation.module index 502d4e4..d7c95db 100644 --- a/core/modules/content_translation/content_translation.module +++ b/core/modules/content_translation/content_translation.module @@ -11,7 +11,7 @@ use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Field\FieldDefinition; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Session\AccountInterface; use Drupal\Core\TypedData\TranslatableInterface; use Drupal\field\Entity\FieldInstanceConfig; @@ -72,8 +72,8 @@ function content_translation_module_implements_alter(&$implementations, $hook) { function content_translation_language_types_info_alter(array &$language_types) { // Make content language negotiation configurable by removing the 'locked' // flag. - $language_types[Language::TYPE_CONTENT]['locked'] = FALSE; - unset($language_types[Language::TYPE_CONTENT]['fixed']); + $language_types[LanguageInterface::TYPE_CONTENT]['locked'] = FALSE; + unset($language_types[LanguageInterface::TYPE_CONTENT]['fixed']); } /** @@ -792,7 +792,7 @@ function content_translation_language_configuration_element_validate($element, a $key = $form_state['content_translation']['key']; $values = $form_state['values'][$key]; if (!$values['language_show'] && $values['content_translation'] && \Drupal::languageManager()->isLanguageLocked($values['langcode'])) { - foreach (\Drupal::languageManager()->getLanguages(Language::STATE_LOCKED) as $language) { + foreach (\Drupal::languageManager()->getLanguages(LanguageInterface::STATE_LOCKED) as $language) { $locked_languages[] = $language->name; } // @todo Set the correct form element name as soon as the element parents diff --git a/core/modules/content_translation/content_translation.pages.inc b/core/modules/content_translation/content_translation.pages.inc index d4a7c48..9898678 100644 --- a/core/modules/content_translation/content_translation.pages.inc +++ b/core/modules/content_translation/content_translation.pages.inc @@ -5,7 +5,7 @@ * The content translation user interface. */ -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\ContentEntityInterface; @@ -171,12 +171,12 @@ function content_translation_overview(EntityInterface $entity) { * A renderable array of language switch links. */ function _content_translation_get_switch_links($path) { - $links = \Drupal::languageManager()->getLanguageSwitchLinks(Language::TYPE_CONTENT, $path); + $links = \Drupal::languageManager()->getLanguageSwitchLinks(LanguageInterface::TYPE_CONTENT, $path); if (empty($links)) { // If content language is set up to fall back to the interface language, - // then there will be no switch links for Language::TYPE_CONTENT, ergo we - // also need to use interface switch links. - $links = \Drupal::languageManager()->getLanguageSwitchLinks(Language::TYPE_INTERFACE, $path); + // then there will be no switch links for LanguageInterface::TYPE_CONTENT, + // ergo we also need to use interface switch links. + $links = \Drupal::languageManager()->getLanguageSwitchLinks(LanguageInterface::TYPE_INTERFACE, $path); } return $links; } @@ -186,10 +186,10 @@ function _content_translation_get_switch_links($path) { * * @param EntityInterface $entity * The entity being translated. - * @param Language $source + * @param \Drupal\Core\Language\LanguageInterface $source * (optional) The language of the values being translated. Defaults to the * entity language. - * @param Language $target + * @param \Drupal\Core\Language\LanguageInterface $target * (optional) The language of the translated values. Defaults to the current * content language. * @@ -199,9 +199,9 @@ function _content_translation_get_switch_links($path) { * @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0. * Use \Drupal\content_translation\Controller\ContentTranslationController::add(). */ -function content_translation_add_page(EntityInterface $entity, Language $source = NULL, Language $target = NULL) { +function content_translation_add_page(EntityInterface $entity, LanguageInterface $source = NULL, LanguageInterface $target = NULL) { $source = !empty($source) ? $source : $entity->language(); - $target = !empty($target) ? $target : \Drupal::languageManager()->getCurrentLanguage(Language::TYPE_CONTENT); + $target = !empty($target) ? $target : \Drupal::languageManager()->getCurrentLanguage(LanguageInterface::TYPE_CONTENT); // @todo Exploit the upcoming hook_entity_prepare() when available. content_translation_prepare_translation($entity, $source, $target); $form_state['langcode'] = $target->id; @@ -216,7 +216,7 @@ function content_translation_add_page(EntityInterface $entity, Language $source * * @param \Drupal\Core\Entity\EntityInterface $entity * The entity being translated. - * @param \Drupal\Core\Language\Language $language + * @param \Drupal\Core\Language\LanguageInterface $language * (optional) The language of the translated values. Defaults to the current * content language. * @@ -226,8 +226,8 @@ function content_translation_add_page(EntityInterface $entity, Language $source * @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0. * Use \Drupal\content_translation\Controller\ContentTranslationController::edit(). */ -function content_translation_edit_page(EntityInterface $entity, Language $language = NULL) { - $language = !empty($language) ? $language : \Drupal::languageManager()->getCurrentLanguage(Language::TYPE_CONTENT); +function content_translation_edit_page(EntityInterface $entity, LanguageInterface $language = NULL) { + $language = !empty($language) ? $language : \Drupal::languageManager()->getCurrentLanguage(LanguageInterface::TYPE_CONTENT); $form_state['langcode'] = $language->id; $form_state['content_translation']['translation_form'] = TRUE; return \Drupal::service('entity.form_builder')->getForm($entity, 'default', $form_state); @@ -238,12 +238,12 @@ function content_translation_edit_page(EntityInterface $entity, Language $langua * * @param \Drupal\Core\Entity\EntityInterface $entity * The entitiy being translated. - * @param \Drupal\Core\Language\Language $source + * @param \Drupal\Core\Language\LanguageInterface $source * The language to be used as source. - * @param \Drupal\Core\Language\Language $target + * @param \Drupal\Core\Language\LanguageInterface $target * The language to be used as target. */ -function content_translation_prepare_translation(EntityInterface $entity, Language $source, Language $target) { +function content_translation_prepare_translation(EntityInterface $entity, LanguageInterface $source, LanguageInterface $target) { if ($entity instanceof ContentEntityInterface) { $source_translation = $entity->getTranslation($source->id); $entity->addTranslation($target->id, $source_translation->toArray()); diff --git a/core/modules/content_translation/lib/Drupal/content_translation/Access/ContentTranslationManageAccessCheck.php b/core/modules/content_translation/lib/Drupal/content_translation/Access/ContentTranslationManageAccessCheck.php index b0e0fb6..137b52e 100644 --- a/core/modules/content_translation/lib/Drupal/content_translation/Access/ContentTranslationManageAccessCheck.php +++ b/core/modules/content_translation/lib/Drupal/content_translation/Access/ContentTranslationManageAccessCheck.php @@ -8,7 +8,7 @@ namespace Drupal\content_translation\Access; use Drupal\Core\Entity\EntityManagerInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Routing\Access\AccessInterface; use Drupal\Core\Session\AccountInterface; use Symfony\Component\Routing\Route; @@ -70,7 +70,7 @@ public function access(Route $route, Request $request, AccountInterface $account switch ($operation) { case 'create': $source = language_load($source) ?: $entity->language(); - $target = language_load($target) ?: \Drupal::languageManager()->getCurrentLanguage(Language::TYPE_CONTENT); + $target = language_load($target) ?: \Drupal::languageManager()->getCurrentLanguage(LanguageInterface::TYPE_CONTENT); return ($source->id != $target->id && isset($languages[$source->id]) && isset($languages[$target->id]) @@ -80,7 +80,7 @@ public function access(Route $route, Request $request, AccountInterface $account case 'update': case 'delete': - $language = language_load($language) ?: \Drupal::languageManager()->getCurrentLanguage(Language::TYPE_CONTENT); + $language = language_load($language) ?: \Drupal::languageManager()->getCurrentLanguage(LanguageInterface::TYPE_CONTENT); return isset($languages[$language->id]) && $language->id != $entity->getUntranslated()->language()->id && isset($translations[$language->id]) diff --git a/core/modules/content_translation/lib/Drupal/content_translation/ContentTranslationHandler.php b/core/modules/content_translation/lib/Drupal/content_translation/ContentTranslationHandler.php index 76723c2..bd9a9c1 100644 --- a/core/modules/content_translation/lib/Drupal/content_translation/ContentTranslationHandler.php +++ b/core/modules/content_translation/lib/Drupal/content_translation/ContentTranslationHandler.php @@ -9,7 +9,7 @@ use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityTypeInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Render\Element; /** @@ -129,7 +129,7 @@ public function entityFormAlter(array &$form, array &$form_state, EntityInterfac '#submit' => array(array($this, 'entityFormSourceChange')), ), ); - foreach (language_list(Language::STATE_CONFIGURABLE) as $language) { + foreach (language_list(LanguageInterface::STATE_CONFIGURABLE) as $language) { if (isset($translations[$language->id])) { $form['source_langcode']['source']['#options'][$language->id] = $language->name; } @@ -142,7 +142,7 @@ public function entityFormAlter(array &$form, array &$form_state, EntityInterfac $language_widget = isset($form['langcode']) && $form['langcode']['#type'] == 'language_select'; if ($language_widget && $has_translations) { $form['langcode']['#options'] = array(); - foreach (language_list(Language::STATE_CONFIGURABLE) as $language) { + foreach (language_list(LanguageInterface::STATE_CONFIGURABLE) as $language) { if (empty($translations[$language->id]) || $language->id == $entity_langcode) { $form['langcode']['#options'][$language->id] = $language->name; } diff --git a/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationSettingsTest.php b/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationSettingsTest.php index 059cb79..d03d30c 100644 --- a/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationSettingsTest.php +++ b/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationSettingsTest.php @@ -7,7 +7,7 @@ namespace Drupal\content_translation\Tests; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\field\Entity\FieldConfig; use Drupal\simpletest\WebTestBase; @@ -76,7 +76,7 @@ function testSettingsUI() { // language is set as default and the language selector is hidden. $edit = array( 'entity_types[comment]' => TRUE, - 'settings[comment][node__comment_article][settings][language][langcode]' => Language::LANGCODE_NOT_SPECIFIED, + 'settings[comment][node__comment_article][settings][language][langcode]' => LanguageInterface::LANGCODE_NOT_SPECIFIED, 'settings[comment][node__comment_article][settings][language][language_show]' => FALSE, 'settings[comment][node__comment_article][translatable]' => TRUE, 'settings[comment][node__comment_article][fields][comment_body]' => TRUE, diff --git a/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationSyncImageTest.php b/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationSyncImageTest.php index 3f990db..5749baf 100644 --- a/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationSyncImageTest.php +++ b/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationSyncImageTest.php @@ -8,7 +8,6 @@ namespace Drupal\content_translation\Tests; use Drupal\Core\Entity\EntityInterface; -use Drupal\Core\Language\Language; /** * Tests the Content Translation image field synchronization capability. diff --git a/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationSyncUnitTest.php b/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationSyncUnitTest.php index a1e0805..509287e 100644 --- a/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationSyncUnitTest.php +++ b/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationSyncUnitTest.php @@ -7,7 +7,6 @@ namespace Drupal\content_translation\Tests; -use Drupal\Core\Language\Language; use Drupal\simpletest\DrupalUnitTestBase; use Drupal\content_translation\FieldTranslationSynchronizer; diff --git a/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationUITest.php b/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationUITest.php index 12caf73..10b56cb 100644 --- a/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationUITest.php +++ b/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationUITest.php @@ -9,7 +9,7 @@ use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\ContentEntityBase; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; /** * Tests the Content Translation UI. @@ -251,7 +251,7 @@ protected function getNewEntityValues($langcode) { */ protected function getEditValues($values, $langcode, $new = FALSE) { $edit = $values[$langcode]; - $langcode = $new ? Language::LANGCODE_NOT_SPECIFIED : $langcode; + $langcode = $new ? LanguageInterface::LANGCODE_NOT_SPECIFIED : $langcode; foreach ($values[$langcode] as $property => $value) { if (is_array($value)) { $edit["{$property}[0][value]"] = $value[0]['value']; diff --git a/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationWorkflowsTest.php b/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationWorkflowsTest.php index 43e5d77..06674b8 100644 --- a/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationWorkflowsTest.php +++ b/core/modules/content_translation/lib/Drupal/content_translation/Tests/ContentTranslationWorkflowsTest.php @@ -7,7 +7,7 @@ namespace Drupal\content_translation\Tests; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\user\UserInterface; /** @@ -183,7 +183,7 @@ protected function assertWorkflows(UserInterface $user, $expected_status) { * Assert that the current page does not contain shared form elements. */ protected function assertNoSharedElements() { - $language_none = Language::LANGCODE_NOT_SPECIFIED; + $language_none = LanguageInterface::LANGCODE_NOT_SPECIFIED; return $this->assertNoFieldByXPath("//input[@name='field_test_text[$language_none][0][value]']", NULL, 'Shared elements are not available on the translation form.'); } diff --git a/core/modules/dblog/lib/Drupal/dblog/Tests/DbLogTest.php b/core/modules/dblog/lib/Drupal/dblog/Tests/DbLogTest.php index 84c05cf..dc13391 100644 --- a/core/modules/dblog/lib/Drupal/dblog/Tests/DbLogTest.php +++ b/core/modules/dblog/lib/Drupal/dblog/Tests/DbLogTest.php @@ -8,7 +8,6 @@ namespace Drupal\dblog\Tests; use Drupal\Component\Utility\Xss; -use Drupal\Core\Language\Language; use Drupal\dblog\Controller\DbLogController; use Drupal\simpletest\WebTestBase; diff --git a/core/modules/editor/lib/Drupal/editor/Tests/QuickEditIntegrationTest.php b/core/modules/editor/lib/Drupal/editor/Tests/QuickEditIntegrationTest.php index 5f0c279..dcaf31d 100644 --- a/core/modules/editor/lib/Drupal/editor/Tests/QuickEditIntegrationTest.php +++ b/core/modules/editor/lib/Drupal/editor/Tests/QuickEditIntegrationTest.php @@ -8,7 +8,7 @@ namespace Drupal\editor\Tests; use Drupal\Component\Serialization\Json; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\quickedit\EditorSelector; use Drupal\quickedit\MetadataGenerator; use Drupal\quickedit\Plugin\InPlaceEditorManager; @@ -119,7 +119,7 @@ public function setUp() { */ protected function getSelectedEditor($entity_id, $field_name, $view_mode = 'default') { $entity = entity_load('entity_test', $entity_id, TRUE); - $items = $entity->getTranslation(Language::LANGCODE_NOT_SPECIFIED)->get($field_name); + $items = $entity->getTranslation(LanguageInterface::LANGCODE_NOT_SPECIFIED)->get($field_name); $options = entity_get_display('entity_test', 'entity_test', $view_mode)->getComponent($field_name); return $this->editorSelector->getEditor($options['type'], $items); } @@ -172,7 +172,7 @@ public function testMetadata() { $entity = entity_load('entity_test', $this->entity->id()); // Verify metadata. - $items = $entity->getTranslation(Language::LANGCODE_NOT_SPECIFIED)->get($this->field_name); + $items = $entity->getTranslation(LanguageInterface::LANGCODE_NOT_SPECIFIED)->get($this->field_name); $metadata = $this->metadataGenerator->generateFieldMetadata($items, 'default'); $expected = array( 'access' => TRUE, @@ -212,7 +212,7 @@ public function testGetUntransformedTextCommand() { // Verify AJAX response. $controller = new EditorController(); $request = new Request(); - $response = $controller->getUntransformedText($entity, $this->field_name, Language::LANGCODE_NOT_SPECIFIED, 'default'); + $response = $controller->getUntransformedText($entity, $this->field_name, LanguageInterface::LANGCODE_NOT_SPECIFIED, 'default'); $expected = array( array( 'command' => 'editorGetUntransformedText', diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceAutoCreateTest.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceAutoCreateTest.php index cc883c8..9c2420b 100644 --- a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceAutoCreateTest.php +++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceAutoCreateTest.php @@ -8,7 +8,6 @@ namespace Drupal\entity_reference\Tests; use Drupal\Core\Field\FieldDefinitionInterface; -use Drupal\Core\Language\Language; use Drupal\simpletest\WebTestBase; /** diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceItemTest.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceItemTest.php index 8c33d47..90e5a25 100644 --- a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceItemTest.php +++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceItemTest.php @@ -9,7 +9,7 @@ use Drupal\Core\Field\FieldItemListInterface; use Drupal\Core\Field\FieldItemInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\field\Tests\FieldUnitTestBase; /** @@ -58,14 +58,14 @@ public function setUp() { $this->vocabulary = entity_create('taxonomy_vocabulary', array( 'name' => $this->randomName(), 'vid' => drupal_strtolower($this->randomName()), - 'langcode' => Language::LANGCODE_NOT_SPECIFIED, + 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, )); $this->vocabulary->save(); $this->term = entity_create('taxonomy_term', array( 'name' => $this->randomName(), 'vid' => $this->vocabulary->id(), - 'langcode' => Language::LANGCODE_NOT_SPECIFIED, + 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, )); $this->term->save(); @@ -106,7 +106,7 @@ public function testContentEntityReferenceItem() { $term2 = entity_create('taxonomy_term', array( 'name' => $this->randomName(), 'vid' => $this->term->bundle(), - 'langcode' => Language::LANGCODE_NOT_SPECIFIED, + 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, )); $term2->save(); @@ -153,7 +153,7 @@ public function testConfigEntityReferenceItem() { $vocabulary2 = entity_create('taxonomy_vocabulary', array( 'name' => $this->randomName(), 'vid' => drupal_strtolower($this->randomName()), - 'langcode' => Language::LANGCODE_NOT_SPECIFIED, + 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, )); $vocabulary2->save(); diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceSelectionAccessTest.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceSelectionAccessTest.php index 19f5035..968e60c 100644 --- a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceSelectionAccessTest.php +++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceSelectionAccessTest.php @@ -8,7 +8,7 @@ namespace Drupal\entity_reference\Tests; use Drupal\Core\Field\FieldDefinitionInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\comment\CommentInterface; use Drupal\simpletest\WebTestBase; @@ -410,7 +410,7 @@ public function testCommentHandler() { 'pid' => 0, 'status' => CommentInterface::PUBLISHED, 'subject' => 'Comment Published <&>', - 'language' => Language::LANGCODE_NOT_SPECIFIED, + 'language' => LanguageInterface::LANGCODE_NOT_SPECIFIED, ), 'published_unpublished' => array( 'entity_id' => $nodes['published']->id(), @@ -421,7 +421,7 @@ public function testCommentHandler() { 'pid' => 0, 'status' => CommentInterface::NOT_PUBLISHED, 'subject' => 'Comment Unpublished <&>', - 'language' => Language::LANGCODE_NOT_SPECIFIED, + 'language' => LanguageInterface::LANGCODE_NOT_SPECIFIED, ), 'unpublished_published' => array( 'entity_id' => $nodes['unpublished']->id(), @@ -432,7 +432,7 @@ public function testCommentHandler() { 'pid' => 0, 'status' => CommentInterface::NOT_PUBLISHED, 'subject' => 'Comment Published on Unpublished node <&>', - 'language' => Language::LANGCODE_NOT_SPECIFIED, + 'language' => LanguageInterface::LANGCODE_NOT_SPECIFIED, ), ); diff --git a/core/modules/field/lib/Drupal/field/Plugin/views/field/Field.php b/core/modules/field/lib/Drupal/field/Plugin/views/field/Field.php index 84b587a..e7f9e01 100644 --- a/core/modules/field/lib/Drupal/field/Plugin/views/field/Field.php +++ b/core/modules/field/lib/Drupal/field/Plugin/views/field/Field.php @@ -16,7 +16,7 @@ use Drupal\Core\Entity\ContentEntityDatabaseStorage; use Drupal\Core\Field\FieldDefinitionInterface; use Drupal\Core\Field\FormatterPluginManager; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Language\LanguageManager; use Drupal\Core\Session\AccountInterface; use Drupal\views\Views; @@ -295,7 +295,7 @@ public function query($use_groupby = FALSE) { $default_langcode = language_default()->id; $langcode = str_replace( array('***CURRENT_LANGUAGE***', '***DEFAULT_LANGUAGE***'), - array($this->languageManager->getCurrentLanguage(Language::TYPE_CONTENT), $default_langcode), + array($this->languageManager->getCurrentLanguage(LanguageInterface::TYPE_CONTENT), $default_langcode), $this->view->display_handler->options['field_langcode'] ); $placeholder = $this->placeholder(); @@ -903,7 +903,7 @@ function field_langcode(EntityInterface $entity) { $default_langcode = language_default()->id; $langcode = str_replace( array('***CURRENT_LANGUAGE***', '***DEFAULT_LANGUAGE***'), - array($this->languageManager->getCurrentLanguage(Language::TYPE_CONTENT), $default_langcode), + array($this->languageManager->getCurrentLanguage(LanguageInterface::TYPE_CONTENT), $default_langcode), $this->view->display_handler->options['field_language'] ); @@ -917,7 +917,7 @@ function field_langcode(EntityInterface $entity) { return $langcode; } else { - return Language::LANGCODE_NOT_SPECIFIED; + return LanguageInterface::LANGCODE_NOT_SPECIFIED; } } diff --git a/core/modules/field/lib/Drupal/field/Tests/DisplayApiTest.php b/core/modules/field/lib/Drupal/field/Tests/DisplayApiTest.php index 3a31e00..9a9ed1e 100644 --- a/core/modules/field/lib/Drupal/field/Tests/DisplayApiTest.php +++ b/core/modules/field/lib/Drupal/field/Tests/DisplayApiTest.php @@ -7,7 +7,7 @@ namespace Drupal\field\Tests; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; /** * Tests the field display API. @@ -149,7 +149,7 @@ function testFieldItemListView() { $setting = $display['settings']['test_formatter_setting_multiple']; $this->assertNoText($this->label, 'Label was not displayed.'); $this->assertText('field_test_entity_display_build_alter', 'Alter fired, display passed.'); - $this->assertText('entity language is ' . Language::LANGCODE_NOT_SPECIFIED, 'Language is placed onto the context.'); + $this->assertText('entity language is ' . LanguageInterface::LANGCODE_NOT_SPECIFIED, 'Language is placed onto the context.'); $array = array(); foreach ($this->values as $delta => $value) { $array[] = $delta . ':' . $value['value']; diff --git a/core/modules/field/lib/Drupal/field/Tests/FieldAttachOtherTest.php b/core/modules/field/lib/Drupal/field/Tests/FieldAttachOtherTest.php index 39f6e28..696021b 100644 --- a/core/modules/field/lib/Drupal/field/Tests/FieldAttachOtherTest.php +++ b/core/modules/field/lib/Drupal/field/Tests/FieldAttachOtherTest.php @@ -7,7 +7,7 @@ namespace Drupal\field\Tests; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; /** * Unit test class for non-storage related field_attach_* functions. @@ -180,7 +180,7 @@ function testEntityDisplayViewMultiple() { function testFieldAttachCache() { // Initialize random values and a test entity. $entity_init = entity_create('entity_test', array('type' => $this->instance->bundle)); - $langcode = Language::LANGCODE_NOT_SPECIFIED; + $langcode = LanguageInterface::LANGCODE_NOT_SPECIFIED; $values = $this->_generateTestFieldValues($this->field->getCardinality()); // Non-cacheable entity type. diff --git a/core/modules/field/lib/Drupal/field/Tests/FieldInfoTest.php b/core/modules/field/lib/Drupal/field/Tests/FieldInfoTest.php index c97a481..673f11b 100644 --- a/core/modules/field/lib/Drupal/field/Tests/FieldInfoTest.php +++ b/core/modules/field/lib/Drupal/field/Tests/FieldInfoTest.php @@ -7,8 +7,6 @@ namespace Drupal\field\Tests; -use Drupal\Core\Language\Language; - /** * Tests field information for fields, instances, and bundles. */ diff --git a/core/modules/field/lib/Drupal/field/Tests/FieldTestBase.php b/core/modules/field/lib/Drupal/field/Tests/FieldTestBase.php index 3f5d2c5..6bf45a4 100644 --- a/core/modules/field/lib/Drupal/field/Tests/FieldTestBase.php +++ b/core/modules/field/lib/Drupal/field/Tests/FieldTestBase.php @@ -8,7 +8,7 @@ namespace Drupal\field\Tests; use Drupal\Core\Entity\EntityInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\simpletest\WebTestBase; /** @@ -46,11 +46,11 @@ function _generateTestFieldValues($cardinality) { * The array of expected values. * @param $langcode * (Optional) The language code for the values. Defaults to - * Drupal\Core\Language\Language::LANGCODE_NOT_SPECIFIED. + * \Drupal\Core\Language\LanguageInterface::LANGCODE_NOT_SPECIFIED. * @param $column * (Optional) The name of the column to check. Defaults to 'value'. */ - function assertFieldValues(EntityInterface $entity, $field_name, $expected_values, $langcode = Language::LANGCODE_NOT_SPECIFIED, $column = 'value') { + function assertFieldValues(EntityInterface $entity, $field_name, $expected_values, $langcode = LanguageInterface::LANGCODE_NOT_SPECIFIED, $column = 'value') { // Re-load the entity to make sure we have the latest changes. entity_get_controller($entity->getEntityTypeId())->resetCache(array($entity->id())); $e = entity_load($entity->getEntityTypeId(), $entity->id()); diff --git a/core/modules/field/lib/Drupal/field/Tests/FieldUnitTestBase.php b/core/modules/field/lib/Drupal/field/Tests/FieldUnitTestBase.php index 5717a23..9f250d2 100644 --- a/core/modules/field/lib/Drupal/field/Tests/FieldUnitTestBase.php +++ b/core/modules/field/lib/Drupal/field/Tests/FieldUnitTestBase.php @@ -9,7 +9,7 @@ use Drupal\Component\Utility\Xss; use Drupal\Core\Entity\EntityInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\simpletest\DrupalUnitTestBase; /** @@ -145,11 +145,11 @@ function _generateTestFieldValues($cardinality) { * The array of expected values. * @param $langcode * (Optional) The language code for the values. Defaults to - * Drupal\Core\Language\Language::LANGCODE_NOT_SPECIFIED. + * \Drupal\Core\Language\LanguageInterface::LANGCODE_NOT_SPECIFIED. * @param $column * (Optional) The name of the column to check. Defaults to 'value'. */ - function assertFieldValues(EntityInterface $entity, $field_name, $expected_values, $langcode = Language::LANGCODE_NOT_SPECIFIED, $column = 'value') { + function assertFieldValues(EntityInterface $entity, $field_name, $expected_values, $langcode = LanguageInterface::LANGCODE_NOT_SPECIFIED, $column = 'value') { // Re-load the entity to make sure we have the latest changes. entity_get_controller($entity->getEntityTypeId())->resetCache(array($entity->id())); $e = entity_load($entity->getEntityTypeId(), $entity->id()); diff --git a/core/modules/field/lib/Drupal/field/Tests/Views/HandlerFieldFieldTest.php b/core/modules/field/lib/Drupal/field/Tests/Views/HandlerFieldFieldTest.php index 9a25836..bb1274e 100644 --- a/core/modules/field/lib/Drupal/field/Tests/Views/HandlerFieldFieldTest.php +++ b/core/modules/field/lib/Drupal/field/Tests/Views/HandlerFieldFieldTest.php @@ -8,7 +8,6 @@ namespace Drupal\field\Tests\Views; use Drupal\Core\Field\FieldDefinitionInterface; -use Drupal\Core\Language\Language; use Drupal\views\ViewExecutable; use Drupal\views\Views; diff --git a/core/modules/field_ui/lib/Drupal/field_ui/Tests/FieldUiTestBase.php b/core/modules/field_ui/lib/Drupal/field_ui/Tests/FieldUiTestBase.php index f103e6d..3e54cea 100644 --- a/core/modules/field_ui/lib/Drupal/field_ui/Tests/FieldUiTestBase.php +++ b/core/modules/field_ui/lib/Drupal/field_ui/Tests/FieldUiTestBase.php @@ -7,7 +7,7 @@ namespace Drupal\field_ui\Tests; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\simpletest\WebTestBase; /** @@ -39,7 +39,7 @@ function setUp() { 'name' => $this->randomName(), 'description' => $this->randomName(), 'vid' => drupal_strtolower($this->randomName()), - 'langcode' => Language::LANGCODE_NOT_SPECIFIED, + 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, 'help' => '', 'nodes' => array('article' => 'article'), 'weight' => mt_rand(0, 10), diff --git a/core/modules/field_ui/lib/Drupal/field_ui/Tests/ManageFieldsTest.php b/core/modules/field_ui/lib/Drupal/field_ui/Tests/ManageFieldsTest.php index 9669ec7..4b19637 100644 --- a/core/modules/field_ui/lib/Drupal/field_ui/Tests/ManageFieldsTest.php +++ b/core/modules/field_ui/lib/Drupal/field_ui/Tests/ManageFieldsTest.php @@ -8,7 +8,7 @@ namespace Drupal\field_ui\Tests; use Drupal\Core\Field\FieldDefinitionInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Component\Utility\String; use Drupal\field\Entity\FieldConfig; use Drupal\field\Entity\FieldInstanceConfig; @@ -42,7 +42,7 @@ function setUp() { $vocabulary = entity_create('taxonomy_vocabulary', array( 'name' => 'Tags', 'vid' => 'tags', - 'langcode' => Language::LANGCODE_NOT_SPECIFIED, + 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, )); $vocabulary->save(); diff --git a/core/modules/file/lib/Drupal/file/Entity/File.php b/core/modules/file/lib/Drupal/file/Entity/File.php index 39f27d6..26416d6 100644 --- a/core/modules/file/lib/Drupal/file/Entity/File.php +++ b/core/modules/file/lib/Drupal/file/Entity/File.php @@ -11,7 +11,7 @@ use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Field\FieldDefinition; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\file\FileInterface; use Drupal\user\UserInterface; @@ -43,7 +43,7 @@ class File extends ContentEntityBase implements FileInterface { * @var array */ protected $values = array( - 'langcode' => array(Language::LANGCODE_DEFAULT => array(0 => array('value' => Language::LANGCODE_NOT_SPECIFIED))), + 'langcode' => array(LanguageInterface::LANGCODE_DEFAULT => array(0 => array('value' => LanguageInterface::LANGCODE_NOT_SPECIFIED))), ); /** diff --git a/core/modules/file/lib/Drupal/file/Tests/FileFieldPathTest.php b/core/modules/file/lib/Drupal/file/Tests/FileFieldPathTest.php index 3366b2b..b9134d3 100644 --- a/core/modules/file/lib/Drupal/file/Tests/FileFieldPathTest.php +++ b/core/modules/file/lib/Drupal/file/Tests/FileFieldPathTest.php @@ -7,8 +7,6 @@ namespace Drupal\file\Tests; -use Drupal\Core\Language\Language; - /** * Tests that files are uploaded to proper locations. */ diff --git a/core/modules/file/lib/Drupal/file/Tests/FileFieldRSSContentTest.php b/core/modules/file/lib/Drupal/file/Tests/FileFieldRSSContentTest.php index ba46dc6..5b75862 100644 --- a/core/modules/file/lib/Drupal/file/Tests/FileFieldRSSContentTest.php +++ b/core/modules/file/lib/Drupal/file/Tests/FileFieldRSSContentTest.php @@ -7,8 +7,6 @@ namespace Drupal\file\Tests; -use Drupal\Core\Language\Language; - /** * Tests that formatters are working properly. */ diff --git a/core/modules/file/lib/Drupal/file/Tests/FileFieldRevisionTest.php b/core/modules/file/lib/Drupal/file/Tests/FileFieldRevisionTest.php index 070217b..ed06571 100644 --- a/core/modules/file/lib/Drupal/file/Tests/FileFieldRevisionTest.php +++ b/core/modules/file/lib/Drupal/file/Tests/FileFieldRevisionTest.php @@ -7,8 +7,6 @@ namespace Drupal\file\Tests; -use Drupal\Core\Language\Language; - /** * Tests file handling with node revisions. */ diff --git a/core/modules/file/lib/Drupal/file/Tests/FilePrivateTest.php b/core/modules/file/lib/Drupal/file/Tests/FilePrivateTest.php index afb0114..3dce48e 100644 --- a/core/modules/file/lib/Drupal/file/Tests/FilePrivateTest.php +++ b/core/modules/file/lib/Drupal/file/Tests/FilePrivateTest.php @@ -7,8 +7,6 @@ namespace Drupal\file\Tests; -use Drupal\Core\Language\Language; - /** * Tests file access on private nodes. */ diff --git a/core/modules/file/lib/Drupal/file/Tests/FileTokenReplaceTest.php b/core/modules/file/lib/Drupal/file/Tests/FileTokenReplaceTest.php index 35bb593..e385934 100644 --- a/core/modules/file/lib/Drupal/file/Tests/FileTokenReplaceTest.php +++ b/core/modules/file/lib/Drupal/file/Tests/FileTokenReplaceTest.php @@ -7,8 +7,6 @@ namespace Drupal\file\Tests; -use Drupal\Core\Language\Language; - /** * Tests the file token replacement in strings. */ diff --git a/core/modules/file/lib/Drupal/file/Tests/SaveTest.php b/core/modules/file/lib/Drupal/file/Tests/SaveTest.php index 50d6847..daa4048 100644 --- a/core/modules/file/lib/Drupal/file/Tests/SaveTest.php +++ b/core/modules/file/lib/Drupal/file/Tests/SaveTest.php @@ -7,7 +7,7 @@ namespace Drupal\file\Tests; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; /** * Tests saving files. @@ -46,7 +46,7 @@ function testFileSave() { $this->assertEqual($loaded_file->isPermanent(), $file->isPermanent(), 'Status was saved correctly.'); $this->assertEqual($file->getSize(), filesize($file->getFileUri()), 'File size was set correctly.', 'File'); $this->assertTrue($file->getChangedTime() > 1, 'File size was set correctly.', 'File'); - $this->assertEqual($loaded_file->langcode->value, Language::LANGCODE_NOT_SPECIFIED, 'Langcode was defaulted correctly.'); + $this->assertEqual($loaded_file->langcode->value, LanguageInterface::LANGCODE_NOT_SPECIFIED, 'Langcode was defaulted correctly.'); // Resave the file, updating the existing record. file_test_reset(); diff --git a/core/modules/filter/filter.module b/core/modules/filter/filter.module index 3efe9ad..943dde2 100644 --- a/core/modules/filter/filter.module +++ b/core/modules/filter/filter.module @@ -9,7 +9,6 @@ use Drupal\Component\Utility\String; use Drupal\Component\Utility\Xss; use Drupal\Core\Cache\Cache; -use Drupal\Core\Language\Language; use Drupal\Core\Render\Element; use Drupal\Core\Session\AccountInterface; use Drupal\Core\Template\Attribute; diff --git a/core/modules/filter/lib/Drupal/filter/FilterPluginManager.php b/core/modules/filter/lib/Drupal/filter/FilterPluginManager.php index 15a2257..6f7a133 100644 --- a/core/modules/filter/lib/Drupal/filter/FilterPluginManager.php +++ b/core/modules/filter/lib/Drupal/filter/FilterPluginManager.php @@ -10,7 +10,6 @@ use Drupal\Component\Plugin\PluginManagerBase; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\Core\Language\Language; use Drupal\Core\Language\LanguageManager; use Drupal\Core\Plugin\DefaultPluginManager; use Drupal\Core\Plugin\Discovery\AlterDecorator; diff --git a/core/modules/filter/lib/Drupal/filter/Tests/FilterSecurityTest.php b/core/modules/filter/lib/Drupal/filter/Tests/FilterSecurityTest.php index 6321c1b..cb98907 100644 --- a/core/modules/filter/lib/Drupal/filter/Tests/FilterSecurityTest.php +++ b/core/modules/filter/lib/Drupal/filter/Tests/FilterSecurityTest.php @@ -7,7 +7,6 @@ namespace Drupal\filter\Tests; -use Drupal\Core\Language\Language; use Drupal\simpletest\WebTestBase; use Drupal\filter\Plugin\FilterInterface; diff --git a/core/modules/hal/lib/Drupal/hal/Normalizer/ContentEntityNormalizer.php b/core/modules/hal/lib/Drupal/hal/Normalizer/ContentEntityNormalizer.php index f374fa3..d433656 100644 --- a/core/modules/hal/lib/Drupal/hal/Normalizer/ContentEntityNormalizer.php +++ b/core/modules/hal/lib/Drupal/hal/Normalizer/ContentEntityNormalizer.php @@ -10,7 +10,7 @@ use Drupal\Component\Utility\NestedArray; use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\rest\LinkManager\LinkManagerInterface; use Symfony\Component\Serializer\Exception\UnexpectedValueException; @@ -136,7 +136,7 @@ public function denormalize($data, $class, $format = NULL, array $context = arra $langcode = language_get_default_langcode($typed_data_ids['entity_type'], $typed_data_ids['bundle']); } else { - $langcode = Language::LANGCODE_NOT_SPECIFIED; + $langcode = LanguageInterface::LANGCODE_NOT_SPECIFIED; } $entity_type = $this->entityManager->getDefinition($typed_data_ids['entity_type']); diff --git a/core/modules/language/language.module b/core/modules/language/language.module index fb95001..b747c77 100644 --- a/core/modules/language/language.module +++ b/core/modules/language/language.module @@ -6,7 +6,7 @@ */ use Drupal\Core\PhpStorage\PhpStorageFactory; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\language\ConfigurableLanguageManager; use Drupal\language\ConfigurableLanguageManagerInterface; use Drupal\language\Entity\Language as LanguageEntity; @@ -132,7 +132,7 @@ function language_element_info_alter(&$type) { $type['language_select']['#process'] = array_merge($type['language_select']['#process'], array('language_process_language_select', 'form_process_select', 'ajax_process_form')); $type['language_select']['#theme'] = 'select'; $type['language_select']['#theme_wrappers'] = array_merge($type['language_select']['#theme_wrappers'], array('form_element')); - $type['language_select']['#languages'] = Language::STATE_CONFIGURABLE; + $type['language_select']['#languages'] = LanguageInterface::STATE_CONFIGURABLE; $type['language_select']['#multiple'] = FALSE; } } @@ -198,7 +198,7 @@ function language_configuration_element_default_options() { 'authors_default' => t("Author's preferred language"), ); - $languages = \Drupal::languageManager()->getLanguages(Language::STATE_ALL); + $languages = \Drupal::languageManager()->getLanguages(LanguageInterface::STATE_ALL); foreach ($languages as $langcode => $language) { $language_options[$langcode] = $language->locked ? t('- @name -', array('@name' => $language->name)) : $language->name; } @@ -446,7 +446,7 @@ function language_save($language) { * TRUE if language is successfully deleted. Otherwise FALSE. */ function language_delete($langcode) { - $languages = \Drupal::languageManager()->getLanguages(Language::STATE_ALL); + $languages = \Drupal::languageManager()->getLanguages(LanguageInterface::STATE_ALL); if (isset($languages[$langcode]) && !$languages[$langcode]->locked) { $language = $languages[$langcode]; @@ -488,18 +488,18 @@ function language_delete($langcode) { */ function language_language_types_info() { return array( - Language::TYPE_INTERFACE => array( + LanguageInterface::TYPE_INTERFACE => array( 'name' => t('User interface text'), 'description' => t('Order of language detection methods for user interface text. If a translation of user interface text is available in the detected language, it will be displayed.'), 'locked' => TRUE, ), - Language::TYPE_CONTENT => array( + LanguageInterface::TYPE_CONTENT => array( 'name' => t('Content'), 'description' => t('Order of language detection methods for content. If a version of content is available in the detected language, it will be displayed.'), 'fixed' => array(LanguageNegotiationUI::METHOD_ID), 'locked' => TRUE, ), - Language::TYPE_URL => array( + LanguageInterface::TYPE_URL => array( 'fixed' => array(LanguageNegotiationUrl::METHOD_ID, LanguageNegotiationUrlFallback::METHOD_ID), 'locked' => TRUE, ), diff --git a/core/modules/language/lib/Drupal/language/Config/LanguageConfigFactoryOverride.php b/core/modules/language/lib/Drupal/language/Config/LanguageConfigFactoryOverride.php index f6fa8ad..6d97601 100644 --- a/core/modules/language/lib/Drupal/language/Config/LanguageConfigFactoryOverride.php +++ b/core/modules/language/lib/Drupal/language/Config/LanguageConfigFactoryOverride.php @@ -12,8 +12,8 @@ use Drupal\Core\Config\ConfigEvents; use Drupal\Core\Config\StorageInterface; use Drupal\Core\Config\TypedConfigManagerInterface; -use Drupal\Core\Language\Language; use Drupal\Core\Language\LanguageDefault; +use Drupal\Core\Language\LanguageInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; @@ -127,7 +127,7 @@ public function getLanguage() { /** * {@inheritdoc} */ - public function setLanguage(Language $language = NULL) { + public function setLanguage(LanguageInterface $language = NULL) { $this->language = $language; return $this; } diff --git a/core/modules/language/lib/Drupal/language/Config/LanguageConfigFactoryOverrideInterface.php b/core/modules/language/lib/Drupal/language/Config/LanguageConfigFactoryOverrideInterface.php index c7b297d..b4ddbb4 100644 --- a/core/modules/language/lib/Drupal/language/Config/LanguageConfigFactoryOverrideInterface.php +++ b/core/modules/language/lib/Drupal/language/Config/LanguageConfigFactoryOverrideInterface.php @@ -8,7 +8,7 @@ namespace Drupal\language\Config; use Drupal\Core\Config\ConfigFactoryOverrideInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Language\LanguageDefault; /** @@ -27,12 +27,12 @@ public function getLanguage(); /** * Sets the language to be used in configuration overrides. * - * @param \Drupal\Core\Language\Language $language + * @param \Drupal\Core\Language\LanguageInterface $language * The language object used to override configuration data. * * @return $this */ - public function setLanguage(Language $language = NULL); + public function setLanguage(LanguageInterface $language = NULL); /** * Sets the language to be used in configuration overrides from the default. diff --git a/core/modules/language/lib/Drupal/language/ConfigurableLanguageManager.php b/core/modules/language/lib/Drupal/language/ConfigurableLanguageManager.php index b28e02b..acd1d64 100644 --- a/core/modules/language/lib/Drupal/language/ConfigurableLanguageManager.php +++ b/core/modules/language/lib/Drupal/language/ConfigurableLanguageManager.php @@ -7,6 +7,7 @@ namespace Drupal\language; +use Drupal\Core\Language\LanguageInterface as BaseLanguageInterface; use Drupal\Core\PhpStorage\PhpStorageFactory; use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Extension\ModuleHandlerInterface; @@ -135,7 +136,7 @@ public function init() { * {@inheritdoc} */ public function isMultilingual() { - return count($this->getLanguages(Language::STATE_CONFIGURABLE)) > 1; + return count($this->getLanguages(BaseLanguageInterface::STATE_CONFIGURABLE)) > 1; } /** @@ -197,7 +198,7 @@ public function saveLanguageTypesConfiguration(array $values) { /** * {@inheritdoc} */ - public function getCurrentLanguage($type = Language::TYPE_INTERFACE) { + public function getCurrentLanguage($type = BaseLanguageInterface::TYPE_INTERFACE) { if (!isset($this->negotiatedLanguages[$type])) { // Ensure we have a valid value for this language type. $this->negotiatedLanguages[$type] = $this->getDefaultLanguage(); @@ -214,8 +215,8 @@ public function getCurrentLanguage($type = Language::TYPE_INTERFACE) { // original strings which can be translated by calling them again // afterwards. This can happen for instance while parsing negotiation // method definitions. - elseif ($type == Language::TYPE_INTERFACE) { - return new Language(array('id' => Language::LANGCODE_SYSTEM)); + elseif ($type == BaseLanguageInterface::TYPE_INTERFACE) { + return new Language(array('id' => BaseLanguageInterface::LANGCODE_SYSTEM)); } } } @@ -269,7 +270,7 @@ public function setNegotiator(LanguageNegotiatorInterface $negotiator) { /** * {@inheritdoc} */ - public function getLanguages($flags = Language::STATE_CONFIGURABLE) { + public function getLanguages($flags = BaseLanguageInterface::STATE_CONFIGURABLE) { if (!isset($this->languages)) { // Prepopulate the language list with the default language to keep things // working even if we have no configuration. @@ -310,14 +311,14 @@ public function updateLockedLanguageWeights() { $max_weight = 0; // Get maximum weight to update the system languages to keep them on bottom. - foreach ($this->getLanguages(Language::STATE_CONFIGURABLE) as $language) { + foreach ($this->getLanguages(BaseLanguageInterface::STATE_CONFIGURABLE) as $language) { if (!$language->locked && $language->weight > $max_weight) { $max_weight = $language->weight; } } // Loop locked languages to maintain the existing order. - $locked_languages = $this->getLanguages(Language::STATE_LOCKED); + $locked_languages = $this->getLanguages(BaseLanguageInterface::STATE_LOCKED); $config_ids = array_map(function($language) { return 'language.entity.' . $language->id; }, $locked_languages); foreach ($this->configFactory->loadMultiple($config_ids) as $config_id => $config) { // Update system languages weight. @@ -335,7 +336,7 @@ public function getFallbackCandidates($langcode = NULL, array $context = array() // Get languages ordered by weight, add Language::LANGCODE_NOT_SPECIFIED // at the end. $candidates = array_keys($this->getLanguages()); - $candidates[] = Language::LANGCODE_NOT_SPECIFIED; + $candidates[] = BaseLanguageInterface::LANGCODE_NOT_SPECIFIED; $candidates = array_combine($candidates, $candidates); // The first candidate should always be the desired language if specified. @@ -388,7 +389,7 @@ public function getLanguageSwitchLinks($type, $path) { /** * {@inheritdoc} */ - public function setConfigOverrideLanguage(Language $language = NULL) { + public function setConfigOverrideLanguage(BaseLanguageInterface $language = NULL) { $this->configFactoryOverride->setLanguage($language); return $this; } diff --git a/core/modules/language/lib/Drupal/language/Form/LanguageFormBase.php b/core/modules/language/lib/Drupal/language/Form/LanguageFormBase.php index d3719bc..583787a 100644 --- a/core/modules/language/lib/Drupal/language/Form/LanguageFormBase.php +++ b/core/modules/language/lib/Drupal/language/Form/LanguageFormBase.php @@ -9,7 +9,7 @@ use Drupal\Component\Utility\String; use Drupal\Core\Entity\EntityForm; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\language\ConfigurableLanguageManagerInterface; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -85,8 +85,8 @@ public function commonForm(array &$form) { '#description' => $this->t('Direction that text in this language is presented.'), '#default_value' => $language->direction, '#options' => array( - Language::DIRECTION_LTR => $this->t('Left to right'), - Language::DIRECTION_RTL => $this->t('Right to left'), + LanguageInterface::DIRECTION_LTR => $this->t('Left to right'), + LanguageInterface::DIRECTION_RTL => $this->t('Right to left'), ), ); diff --git a/core/modules/language/lib/Drupal/language/Form/NegotiationSelectedForm.php b/core/modules/language/lib/Drupal/language/Form/NegotiationSelectedForm.php index 14c13f4..47d61eb 100644 --- a/core/modules/language/lib/Drupal/language/Form/NegotiationSelectedForm.php +++ b/core/modules/language/lib/Drupal/language/Form/NegotiationSelectedForm.php @@ -7,7 +7,7 @@ namespace Drupal\language\Form; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Form\ConfigFormBase; /** @@ -30,7 +30,7 @@ public function buildForm(array $form, array &$form_state) { $form['selected_langcode'] = array( '#type' => 'language_select', '#title' => t('Language'), - '#languages' => Language::STATE_CONFIGURABLE | Language::STATE_SITE_DEFAULT, + '#languages' => LanguageInterface::STATE_CONFIGURABLE | LanguageInterface::STATE_SITE_DEFAULT, '#default_value' => $config->get('selected_langcode'), ); diff --git a/core/modules/language/lib/Drupal/language/LanguageNegotiationMethodBase.php b/core/modules/language/lib/Drupal/language/LanguageNegotiationMethodBase.php index 9ed0f7c..3f48f7a 100644 --- a/core/modules/language/lib/Drupal/language/LanguageNegotiationMethodBase.php +++ b/core/modules/language/lib/Drupal/language/LanguageNegotiationMethodBase.php @@ -8,7 +8,7 @@ namespace Drupal\language; use Drupal\Core\Config\ConfigFactoryInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface as BaseLanguageInterface; use Drupal\Core\Session\AccountInterface; /** @@ -61,7 +61,7 @@ public function setCurrentUser(AccountInterface $current_user) { /** * {@inheritdoc} */ - public function persist(Language $language) { + public function persist(BaseLanguageInterface $language) { // Remember the method ID used to detect the language. $language->method_id = static::METHOD_ID; } diff --git a/core/modules/language/lib/Drupal/language/LanguageNegotiationMethodInterface.php b/core/modules/language/lib/Drupal/language/LanguageNegotiationMethodInterface.php index fefa585..1913d41 100644 --- a/core/modules/language/lib/Drupal/language/LanguageNegotiationMethodInterface.php +++ b/core/modules/language/lib/Drupal/language/LanguageNegotiationMethodInterface.php @@ -8,7 +8,7 @@ namespace Drupal\language; use Drupal\Core\Config\ConfigFactoryInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface as BaseLanguageInterface; use Drupal\Core\Session\AccountInterface; use Symfony\Component\HttpFoundation\Request; @@ -57,9 +57,9 @@ public function getLangcode(Request $request = NULL); /** * Notifies the plugin that the language code it returned has been accepted. * - * @param \Drupal\Core\Language\Language $language + * @param \Drupal\Core\Language\LanguageInterface $language * The accepted language. */ - public function persist(Language $language); + public function persist(BaseLanguageInterface $language); } diff --git a/core/modules/language/lib/Drupal/language/LanguageServiceProvider.php b/core/modules/language/lib/Drupal/language/LanguageServiceProvider.php index 95eb700..a565c1c 100644 --- a/core/modules/language/lib/Drupal/language/LanguageServiceProvider.php +++ b/core/modules/language/lib/Drupal/language/LanguageServiceProvider.php @@ -10,7 +10,7 @@ use Drupal\Core\Config\BootstrapConfigStorageFactory; use Drupal\Core\DependencyInjection\ContainerBuilder; use Drupal\Core\DependencyInjection\ServiceProviderBase; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface as BaseLanguageInterface; use Symfony\Component\DependencyInjection\Reference; /** @@ -81,7 +81,7 @@ protected function isMultilingual() { // container has finished building. $config_storage = BootstrapConfigStorageFactory::get(); $config_ids = array_filter($config_storage->listAll($prefix), function($config_id) use ($prefix) { - return $config_id != $prefix . Language::LANGCODE_NOT_SPECIFIED && $config_id != $prefix . Language::LANGCODE_NOT_APPLICABLE; + return $config_id != $prefix . BaseLanguageInterface::LANGCODE_NOT_SPECIFIED && $config_id != $prefix . BaseLanguageInterface::LANGCODE_NOT_APPLICABLE; }); return count($config_ids) > 1; } diff --git a/core/modules/language/lib/Drupal/language/Plugin/LanguageNegotiation/LanguageNegotiationSession.php b/core/modules/language/lib/Drupal/language/Plugin/LanguageNegotiation/LanguageNegotiationSession.php index e56278d..8cf294a 100644 --- a/core/modules/language/lib/Drupal/language/Plugin/LanguageNegotiation/LanguageNegotiationSession.php +++ b/core/modules/language/lib/Drupal/language/Plugin/LanguageNegotiation/LanguageNegotiationSession.php @@ -7,7 +7,7 @@ namespace Drupal\language\Plugin\LanguageNegotiation; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\PathProcessor\OutboundPathProcessorInterface; use Drupal\language\LanguageNegotiationMethodBase; use Drupal\language\LanguageSwitcherInterface; @@ -68,7 +68,7 @@ public function getLangcode(Request $request = NULL) { /** * {@inheritdoc} */ - public function persist(Language $language) { + public function persist(LanguageInterface $language) { parent::persist($language); // We need to update the session parameter with the request value only if we diff --git a/core/modules/language/lib/Drupal/language/Plugin/LanguageNegotiation/LanguageNegotiationUrl.php b/core/modules/language/lib/Drupal/language/Plugin/LanguageNegotiation/LanguageNegotiationUrl.php index 42a0933..18a2805 100644 --- a/core/modules/language/lib/Drupal/language/Plugin/LanguageNegotiation/LanguageNegotiationUrl.php +++ b/core/modules/language/lib/Drupal/language/Plugin/LanguageNegotiation/LanguageNegotiationUrl.php @@ -7,7 +7,7 @@ namespace Drupal\language\Plugin\LanguageNegotiation; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\PathProcessor\InboundPathProcessorInterface; use Drupal\Core\PathProcessor\OutboundPathProcessorInterface; use Drupal\language\LanguageNegotiationMethodBase; @@ -129,7 +129,7 @@ public function processOutbound($path, &$options = array(), Request $request = N $languages = array_flip(array_keys($this->languageManager->getLanguages())); // Language can be passed as an option, or we go for current URL language. if (!isset($options['language'])) { - $language_url = $this->languageManager->getCurrentLanguage(Language::TYPE_URL); + $language_url = $this->languageManager->getCurrentLanguage(LanguageInterface::TYPE_URL); $options['language'] = $language_url; } // We allow only added languages here. diff --git a/core/modules/language/lib/Drupal/language/Tests/LanguageConfigurationTest.php b/core/modules/language/lib/Drupal/language/Tests/LanguageConfigurationTest.php index 6093263..39eb36f 100644 --- a/core/modules/language/lib/Drupal/language/Tests/LanguageConfigurationTest.php +++ b/core/modules/language/lib/Drupal/language/Tests/LanguageConfigurationTest.php @@ -7,7 +7,7 @@ namespace Drupal\language\Tests; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\simpletest\WebTestBase; /** @@ -160,7 +160,7 @@ protected function checkConfigurableLanguageWeight($state = 'by default') { \Drupal::languageManager()->reset(); $max_configurable_language_weight = $this->getHighestConfigurableLanguageWeight(); $replacements = array('@event' => $state); - foreach (\Drupal::languageManager()->getLanguages(Language::STATE_LOCKED) as $locked_language) { + foreach (\Drupal::languageManager()->getLanguages(LanguageInterface::STATE_LOCKED) as $locked_language) { $replacements['%language'] = $locked_language->name; $this->assertTrue($locked_language->weight > $max_configurable_language_weight, format_string('System language %language has higher weight than configurable languages @event', $replacements)); } diff --git a/core/modules/language/lib/Drupal/language/Tests/LanguageCustomLanguageConfigurationTest.php b/core/modules/language/lib/Drupal/language/Tests/LanguageCustomLanguageConfigurationTest.php index 9554dd8..b8481ac 100644 --- a/core/modules/language/lib/Drupal/language/Tests/LanguageCustomLanguageConfigurationTest.php +++ b/core/modules/language/lib/Drupal/language/Tests/LanguageCustomLanguageConfigurationTest.php @@ -9,6 +9,7 @@ use Drupal\simpletest\WebTestBase; use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; /** * Functional tests for language configuration. @@ -57,7 +58,7 @@ public function testLanguageConfiguration() { 'predefined_langcode' => 'custom', 'langcode' => 'white space', 'name' => 'evil markup', - 'direction' => Language::DIRECTION_LTR, + 'direction' => LanguageInterface::DIRECTION_LTR, ); $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language')); $this->assertRaw(t('%field may only contain characters a-z, underscores, or hyphens.', array('%field' => t('Language code')))); @@ -69,7 +70,7 @@ public function testLanguageConfiguration() { 'predefined_langcode' => 'custom', 'langcode' => 'de', 'name' => 'German', - 'direction' => Language::DIRECTION_LTR, + 'direction' => LanguageInterface::DIRECTION_LTR, ); // Add the language the first time. diff --git a/core/modules/language/lib/Drupal/language/Tests/LanguageFallbackTest.php b/core/modules/language/lib/Drupal/language/Tests/LanguageFallbackTest.php index fb621d8..335909b 100644 --- a/core/modules/language/lib/Drupal/language/Tests/LanguageFallbackTest.php +++ b/core/modules/language/lib/Drupal/language/Tests/LanguageFallbackTest.php @@ -8,6 +8,7 @@ namespace Drupal\language\Tests; use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; /** * Tests the language fallback behavior. @@ -41,7 +42,7 @@ protected function setUp() { */ public function testCandidates() { $language_list = $this->languageManager->getLanguages(); - $expected = array_keys($language_list + array(Language::LANGCODE_NOT_SPECIFIED => NULL)); + $expected = array_keys($language_list + array(LanguageInterface::LANGCODE_NOT_SPECIFIED => NULL)); // Check that language fallback candidates by default are all the available // languages sorted by weight. @@ -57,8 +58,8 @@ public function testCandidates() { // Check that candidates are alterable for specific operations. $this->state->set('language_test.fallback_alter.candidates', FALSE); $this->state->set('language_test.fallback_operation_alter.candidates', TRUE); - $expected[] = Language::LANGCODE_NOT_SPECIFIED; - $expected[] = Language::LANGCODE_NOT_APPLICABLE; + $expected[] = LanguageInterface::LANGCODE_NOT_SPECIFIED; + $expected[] = LanguageInterface::LANGCODE_NOT_APPLICABLE; $candidates = $this->languageManager->getFallbackCandidates(NULL, array('operation' => 'test')); $this->assertEqual(array_values($candidates), $expected, 'Language fallback candidates are alterable for specific operations.'); @@ -70,7 +71,7 @@ public function testCandidates() { } } $candidates = $this->languageManager->getFallbackCandidates(); - $this->assertEqual(array_values($candidates), array(Language::LANGCODE_DEFAULT), 'Language fallback is not applied when the Language module is not enabled.'); + $this->assertEqual(array_values($candidates), array(LanguageInterface::LANGCODE_DEFAULT), 'Language fallback is not applied when the Language module is not enabled.'); } } diff --git a/core/modules/language/lib/Drupal/language/Tests/LanguageListTest.php b/core/modules/language/lib/Drupal/language/Tests/LanguageListTest.php index d5abded..6d45905 100644 --- a/core/modules/language/lib/Drupal/language/Tests/LanguageListTest.php +++ b/core/modules/language/lib/Drupal/language/Tests/LanguageListTest.php @@ -9,6 +9,7 @@ use Drupal\simpletest\WebTestBase; use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; /** * Functional tests for the language list configuration forms. @@ -179,10 +180,10 @@ function testLanguageStates() { $expected_all_languages = array('l4' => 'l4', 'l3' => 'l3', 'l2' => 'l2', 'l1' => 'l1', 'en' => 'en', 'und' => 'und', 'zxx' => 'zxx'); $expected_conf_languages = array('l3' => 'l3', 'l1' => 'l1', 'en' => 'en'); - $locked_languages = $this->container->get('language_manager')->getLanguages(Language::STATE_LOCKED); + $locked_languages = $this->container->get('language_manager')->getLanguages(LanguageInterface::STATE_LOCKED); $this->assertEqual(array_diff_key($expected_locked_languages, $locked_languages), array(), 'Locked languages loaded correctly.'); - $all_languages = $this->container->get('language_manager')->getLanguages(Language::STATE_ALL); + $all_languages = $this->container->get('language_manager')->getLanguages(LanguageInterface::STATE_ALL); $this->assertEqual(array_diff_key($expected_all_languages, $all_languages), array(), 'All languages loaded correctly.'); $conf_languages = $this->container->get('language_manager')->getLanguages(); diff --git a/core/modules/language/lib/Drupal/language/Tests/LanguageNegotiationInfoTest.php b/core/modules/language/lib/Drupal/language/Tests/LanguageNegotiationInfoTest.php index 70d297c..19d4d82 100644 --- a/core/modules/language/lib/Drupal/language/Tests/LanguageNegotiationInfoTest.php +++ b/core/modules/language/lib/Drupal/language/Tests/LanguageNegotiationInfoTest.php @@ -7,7 +7,7 @@ namespace Drupal\language\Tests; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUI; use Drupal\simpletest\WebTestBase; @@ -91,7 +91,7 @@ function testInfoAlterations() { // of saving the language negotiation settings. $this->checkFixedLanguageTypes(); - $type = Language::TYPE_CONTENT; + $type = LanguageInterface::TYPE_CONTENT; $language_types = $this->languageManager()->getLanguageTypes(); $this->assertTrue(in_array($type, $language_types), 'Content language type is configurable.'); @@ -138,7 +138,7 @@ function testInfoAlterations() { $last = $this->container->get('state')->get('language_test.language_negotiation_last'); foreach ($this->languageManager()->getDefinedLanguageTypes() as $type) { $langcode = $last[$type]; - $value = $type == Language::TYPE_CONTENT || strpos($type, 'test') !== FALSE ? 'it' : 'en'; + $value = $type == LanguageInterface::TYPE_CONTENT || strpos($type, 'test') !== FALSE ? 'it' : 'en'; $this->assertEqual($langcode, $value, format_string('The negotiated language for %type is %language', array('%type' => $type, '%language' => $value))); } diff --git a/core/modules/language/lib/Drupal/language/Tests/LanguageSwitchingTest.php b/core/modules/language/lib/Drupal/language/Tests/LanguageSwitchingTest.php index b4c4616..d7609cc 100644 --- a/core/modules/language/lib/Drupal/language/Tests/LanguageSwitchingTest.php +++ b/core/modules/language/lib/Drupal/language/Tests/LanguageSwitchingTest.php @@ -7,7 +7,7 @@ namespace Drupal\language\Tests; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\simpletest\WebTestBase; /** @@ -43,7 +43,7 @@ function setUp() { */ function testLanguageBlock() { // Enable the language switching block.. - $block = $this->drupalPlaceBlock('language_block:' . Language::TYPE_INTERFACE, array( + $block = $this->drupalPlaceBlock('language_block:' . LanguageInterface::TYPE_INTERFACE, array( 'id' => 'test_language_block', // Ensure a 2-byte UTF-8 sequence is in the tested output. 'label' => $this->randomName(8) . '×', diff --git a/core/modules/language/lib/Drupal/language/Tests/LanguageUILanguageNegotiationTest.php b/core/modules/language/lib/Drupal/language/Tests/LanguageUILanguageNegotiationTest.php index 1a2e5d6..9ccdd9f 100644 --- a/core/modules/language/lib/Drupal/language/Tests/LanguageUILanguageNegotiationTest.php +++ b/core/modules/language/lib/Drupal/language/Tests/LanguageUILanguageNegotiationTest.php @@ -14,6 +14,7 @@ use Drupal\user\Plugin\LanguageNegotiation\LanguageNegotiationUserAdmin; use Drupal\simpletest\WebTestBase; use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Symfony\Component\HttpFoundation\Request; use Drupal\language\LanguageNegotiatorInterface; @@ -243,7 +244,7 @@ function testUILanguageNegotiation() { // Unknown language prefix should return 404. $definitions = \Drupal::languageManager()->getNegotiator()->getNegotiationMethods(); \Drupal::config('language.types') - ->set('negotiation.' . Language::TYPE_INTERFACE . '.enabled', array_flip(array_keys($definitions))) + ->set('negotiation.' . LanguageInterface::TYPE_INTERFACE . '.enabled', array_flip(array_keys($definitions))) ->save(); $this->drupalGet("$langcode_unknown/admin/config", array(), $http_header_browser_fallback); $this->assertResponse(404, "Unknown language path prefix should return 404"); @@ -338,7 +339,7 @@ function testUILanguageNegotiation() { protected function runTest($test) { if (!empty($test['language_negotiation'])) { $method_weights = array_flip($test['language_negotiation']); - $this->container->get('language_negotiator')->saveConfiguration(Language::TYPE_INTERFACE, $method_weights); + $this->container->get('language_negotiator')->saveConfiguration(LanguageInterface::TYPE_INTERFACE, $method_weights); } if (!empty($test['language_negotiation_url_part'])) { \Drupal::config('language.negotiation') @@ -382,7 +383,7 @@ function testUrlLanguageFallback() { $this->drupalGet('admin/config/regional/language/detection'); // Enable the language switcher block. - $this->drupalPlaceBlock('language_block:' . Language::TYPE_INTERFACE, array('id' => 'test_language_block')); + $this->drupalPlaceBlock('language_block:' . LanguageInterface::TYPE_INTERFACE, array('id' => 'test_language_block')); // Log out, because for anonymous users, the "active" class is set by PHP // (which means we can easily test it here), whereas for authenticated users diff --git a/core/modules/language/tests/language_test/language_test.module b/core/modules/language/tests/language_test/language_test.module index e1fd47e..aaa34fd 100644 --- a/core/modules/language/tests/language_test/language_test.module +++ b/core/modules/language/tests/language_test/language_test.module @@ -5,7 +5,7 @@ * Mock module for language layer tests. */ -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUI; /** @@ -41,13 +41,13 @@ function language_test_language_types_info() { */ function language_test_language_types_info_alter(array &$language_types) { if (\Drupal::state()->get('language_test.content_language_type')) { - $language_types[Language::TYPE_CONTENT]['locked'] = FALSE; - unset($language_types[Language::TYPE_CONTENT]['fixed']); - // By default languages are not configurable. Make Language::TYPE_CONTENT - // configurable. + $language_types[LanguageInterface::TYPE_CONTENT]['locked'] = FALSE; + unset($language_types[LanguageInterface::TYPE_CONTENT]['fixed']); + // By default languages are not configurable. Make + // LanguageInterface::TYPE_CONTENT configurable. $configurable = \Drupal::config('language.types')->get('configurable'); - if (!in_array(Language::TYPE_CONTENT, $configurable)) { - $configurable[] = Language::TYPE_CONTENT; + if (!in_array(LanguageInterface::TYPE_CONTENT, $configurable)) { + $configurable[] = LanguageInterface::TYPE_CONTENT; \Drupal::config('language.types')->set('configurable', $configurable)->save(); } } @@ -80,7 +80,7 @@ function language_test_store_language_negotiation() { */ function language_test_language_fallback_candidates_alter(array &$candidates, array $context) { if (Drupal::state()->get('language_test.fallback_alter.candidates')) { - unset($candidates[Language::LANGCODE_NOT_SPECIFIED]); + unset($candidates[LanguageInterface::LANGCODE_NOT_SPECIFIED]); } } @@ -89,7 +89,7 @@ function language_test_language_fallback_candidates_alter(array &$candidates, ar */ function language_test_language_fallback_candidates_test_alter(array &$candidates, array $context) { if (Drupal::state()->get('language_test.fallback_operation_alter.candidates')) { - $langcode = Language::LANGCODE_NOT_APPLICABLE; + $langcode = LanguageInterface::LANGCODE_NOT_APPLICABLE; $candidates[$langcode] = $langcode; } } diff --git a/core/modules/locale/lib/Drupal/locale/Form/ExportForm.php b/core/modules/locale/lib/Drupal/locale/Form/ExportForm.php index 433c8c9..189947e 100644 --- a/core/modules/locale/lib/Drupal/locale/Form/ExportForm.php +++ b/core/modules/locale/lib/Drupal/locale/Form/ExportForm.php @@ -10,6 +10,7 @@ use Drupal\Component\Gettext\PoStreamWriter; use Drupal\Core\Form\FormBase; use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Language\LanguageManagerInterface; use Drupal\locale\PoDatabaseReader; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -69,7 +70,7 @@ public function buildForm(array $form, array &$form_state) { if (empty($language_options)) { $form['langcode'] = array( '#type' => 'value', - '#value' => Language::LANGCODE_SYSTEM, + '#value' => LanguageInterface::LANGCODE_SYSTEM, ); $form['langcode_text'] = array( '#type' => 'item', @@ -84,7 +85,7 @@ public function buildForm(array $form, array &$form_state) { '#options' => $language_options, '#default_value' => $language_default->id, '#empty_option' => $this->t('Source text only, no translations'), - '#empty_value' => Language::LANGCODE_SYSTEM, + '#empty_value' => LanguageInterface::LANGCODE_SYSTEM, ); $form['content_options'] = array( '#type' => 'details', @@ -93,7 +94,7 @@ public function buildForm(array $form, array &$form_state) { '#tree' => TRUE, '#states' => array( 'invisible' => array( - ':input[name="langcode"]' => array('value' => Language::LANGCODE_SYSTEM), + ':input[name="langcode"]' => array('value' => LanguageInterface::LANGCODE_SYSTEM), ), ), ); @@ -129,7 +130,7 @@ public function buildForm(array $form, array &$form_state) { */ public function submitForm(array &$form, array &$form_state) { // If template is required, language code is not given. - if ($form_state['values']['langcode'] != Language::LANGCODE_SYSTEM) { + if ($form_state['values']['langcode'] != LanguageInterface::LANGCODE_SYSTEM) { $language = $this->languageManager->getLanguage($form_state['values']['langcode']); } else { diff --git a/core/modules/locale/lib/Drupal/locale/LocaleConfigManager.php b/core/modules/locale/lib/Drupal/locale/LocaleConfigManager.php index 5b0aa4e..9e0f3de 100644 --- a/core/modules/locale/lib/Drupal/locale/LocaleConfigManager.php +++ b/core/modules/locale/lib/Drupal/locale/LocaleConfigManager.php @@ -8,10 +8,10 @@ namespace Drupal\locale; use Drupal\Core\Cache\CacheBackendInterface; -use Drupal\Core\Language\Language; use Drupal\Core\Config\TypedConfigManager; use Drupal\Core\Config\StorageInterface; use Drupal\Core\Config\ConfigFactoryInterface; +use Drupal\Core\Language\LanguageInterface; use Drupal\language\ConfigurableLanguageManagerInterface; /** @@ -307,13 +307,13 @@ public function translateString($name, $langcode, $source, $context) { * * @param string $name * Configuration name. - * @param \Drupal\Core\Language\Language $language + * @param \Drupal\Core\Language\LanguageInterface $language * A language object. * * @return bool * A boolean indicating if a language has configuration translations. */ - public function hasTranslation($name, Language $language) { + public function hasTranslation($name, LanguageInterface $language) { $translation = $this->languageManager->getLanguageConfigOverride($language->id, $name); return !$translation->isNew(); } diff --git a/core/modules/locale/lib/Drupal/locale/LocaleTranslation.php b/core/modules/locale/lib/Drupal/locale/LocaleTranslation.php index 63abc07..d9a9800 100644 --- a/core/modules/locale/lib/Drupal/locale/LocaleTranslation.php +++ b/core/modules/locale/lib/Drupal/locale/LocaleTranslation.php @@ -10,7 +10,7 @@ use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\DestructableInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Language\LanguageManagerInterface; use Drupal\Core\Lock\LockBackendInterface; use Drupal\Core\StringTranslation\Translator\TranslatorInterface; @@ -101,7 +101,7 @@ public function __construct(StringStorageInterface $storage, CacheBackendInterfa */ public function getStringTranslation($langcode, $string, $context) { // If the language is not suitable for locale module, just return. - if ($langcode == Language::LANGCODE_SYSTEM || ($langcode == 'en' && !$this->canTranslateEnglish())) { + if ($langcode == LanguageInterface::LANGCODE_SYSTEM || ($langcode == 'en' && !$this->canTranslateEnglish())) { return FALSE; } // Strings are cached by langcode, context and roles, using instances of the diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocalePathTest.php b/core/modules/locale/lib/Drupal/locale/Tests/LocalePathTest.php index cae7f4b..64d9b1b 100644 --- a/core/modules/locale/lib/Drupal/locale/Tests/LocalePathTest.php +++ b/core/modules/locale/lib/Drupal/locale/Tests/LocalePathTest.php @@ -7,7 +7,7 @@ namespace Drupal\locale\Tests; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\simpletest\WebTestBase; /** @@ -106,7 +106,7 @@ function testPathLanguageConfiguration() { $edit = array( 'source' => 'node/' . $node->id(), 'alias' => $custom_path, - 'langcode' => Language::LANGCODE_NOT_SPECIFIED, + 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, ); $this->container->get('path.alias_storage')->save($edit['source'], $edit['alias'], $edit['langcode']); $lookup_path = $this->container->get('path.alias_manager')->getAliasByPath('node/' . $node->id(), 'en'); @@ -118,7 +118,7 @@ function testPathLanguageConfiguration() { // Create language nodes to check priority of aliases. $first_node = $this->drupalCreateNode(array('type' => 'page', 'promote' => 1, 'langcode' => 'en')); - $second_node = $this->drupalCreateNode(array('type' => 'page', 'promote' => 1, 'langcode' => Language::LANGCODE_NOT_SPECIFIED)); + $second_node = $this->drupalCreateNode(array('type' => 'page', 'promote' => 1, 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED)); // Assign a custom path alias to the first node with the English language. $edit = array( diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocaleTranslationUiTest.php b/core/modules/locale/lib/Drupal/locale/Tests/LocaleTranslationUiTest.php index fa33010..ed3660d 100644 --- a/core/modules/locale/lib/Drupal/locale/Tests/LocaleTranslationUiTest.php +++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleTranslationUiTest.php @@ -10,6 +10,7 @@ use Drupal\Core\Cache\Cache; use Drupal\simpletest\WebTestBase; use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Component\Utility\String; /** @@ -152,7 +153,7 @@ function testStringTranslation() { $this->container->get('string_translation')->reset(); // Now we should get the proper fresh translation from t(). $this->assertTrue($name != $translation_to_en && t($name, array(), array('langcode' => 'en')) == $translation_to_en, 't() works for English.'); - $this->assertTrue(t($name, array(), array('langcode' => Language::LANGCODE_SYSTEM)) == $name, 't() works for Language::LANGCODE_SYSTEM.'); + $this->assertTrue(t($name, array(), array('langcode' => LanguageInterface::LANGCODE_SYSTEM)) == $name, 't() works for Language::LANGCODE_SYSTEM.'); $search = array( 'string' => $name, diff --git a/core/modules/locale/locale.bulk.inc b/core/modules/locale/locale.bulk.inc index 06c0887..2aafd92 100644 --- a/core/modules/locale/locale.bulk.inc +++ b/core/modules/locale/locale.bulk.inc @@ -7,6 +7,7 @@ use Drupal\locale\Gettext; use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\file\FileInterface; /** @@ -192,7 +193,7 @@ function locale_translate_batch_import($file, $options, &$context) { 'customized' => LOCALE_NOT_CUSTOMIZED, ); - if (isset($file->langcode) && $file->langcode != Language::LANGCODE_NOT_SPECIFIED) { + if (isset($file->langcode) && $file->langcode != LanguageInterface::LANGCODE_NOT_SPECIFIED) { try { if (empty($context['sandbox'])) { @@ -459,7 +460,7 @@ function locale_translate_file_attach_properties($file, $options = array()) { $file->langcode = isset($options['langcode']) ? $options['langcode'] : $matches[5]; } else { - $file->langcode = Language::LANGCODE_NOT_SPECIFIED; + $file->langcode = LanguageInterface::LANGCODE_NOT_SPECIFIED; } return $file; } diff --git a/core/modules/locale/locale.module b/core/modules/locale/locale.module index d3e05dc..06fa802 100644 --- a/core/modules/locale/locale.module +++ b/core/modules/locale/locale.module @@ -15,6 +15,7 @@ use Drupal\Component\Utility\Xss; use Drupal\Core\Cache\Cache; use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\language\Entity\Language as LanguageEntity; use Drupal\Component\Utility\Crypt; use Symfony\Component\HttpFoundation\Request; @@ -628,7 +629,7 @@ function locale_library_alter(array &$library, $name) { $language_interface = \Drupal::languageManager()->getCurrentLanguage(); $settings['jquery']['ui']['datepicker'] = array( - 'isRTL' => $language_interface->direction == Language::DIRECTION_RTL, + 'isRTL' => $language_interface->direction == LanguageInterface::DIRECTION_RTL, 'firstDay' => \Drupal::config('system.date')->get('first_day'), ); $library['js'][] = array( @@ -801,7 +802,7 @@ function locale_system_file_system_settings_submit(&$form, $form_state) { * Implements hook_preprocess_HOOK() for node templates. */ function locale_preprocess_node(&$variables) { - if ($variables['node']->language()->id != Language::LANGCODE_NOT_SPECIFIED) { + if ($variables['node']->language()->id != LanguageInterface::LANGCODE_NOT_SPECIFIED) { $language_interface = \Drupal::languageManager()->getCurrentLanguage(); $node_language = $variables['node']->language(); diff --git a/core/modules/menu_ui/lib/Drupal/menu_ui/MenuForm.php b/core/modules/menu_ui/lib/Drupal/menu_ui/MenuForm.php index 4913b83..b24ae13 100644 --- a/core/modules/menu_ui/lib/Drupal/menu_ui/MenuForm.php +++ b/core/modules/menu_ui/lib/Drupal/menu_ui/MenuForm.php @@ -11,6 +11,7 @@ use Drupal\Core\Entity\EntityForm; use Drupal\Core\Entity\Query\QueryFactory; use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Render\Element; use Drupal\menu_link\MenuLinkStorageInterface; use Drupal\menu_link\MenuTreeInterface; @@ -117,7 +118,7 @@ public function form(array $form, array &$form_state) { $form['langcode'] = array( '#type' => 'language_select', '#title' => t('Menu language'), - '#languages' => Language::STATE_ALL, + '#languages' => LanguageInterface::STATE_ALL, '#default_value' => $menu->langcode, ); // Unlike the menu langcode, the default language configuration for menu diff --git a/core/modules/migrate/lib/Drupal/migrate/Plugin/migrate/process/MachineName.php b/core/modules/migrate/lib/Drupal/migrate/Plugin/migrate/process/MachineName.php index 80532bc..9af3fdc 100644 --- a/core/modules/migrate/lib/Drupal/migrate/Plugin/migrate/process/MachineName.php +++ b/core/modules/migrate/lib/Drupal/migrate/Plugin/migrate/process/MachineName.php @@ -7,7 +7,7 @@ namespace Drupal\migrate\Plugin\migrate\process; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\migrate\ProcessPluginBase; use Drupal\migrate\MigrateExecutable; use Drupal\migrate\Row; @@ -34,7 +34,7 @@ class MachineName extends ProcessPluginBase { * {@inheritdoc} */ public function transform($value, MigrateExecutable $migrate_executable, Row $row, $destination_property) { - $new_value = $this->getTransliteration()->transliterate($value, Language::LANGCODE_DEFAULT, '_'); + $new_value = $this->getTransliteration()->transliterate($value, LanguageInterface::LANGCODE_DEFAULT, '_'); $new_value = strtolower($new_value); $new_value = preg_replace('/[^a-z0-9_]+/', '_', $new_value); return preg_replace('/_+/', '_', $new_value); diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateAggregatorFeedTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateAggregatorFeedTest.php index 1110f72..6b57800 100644 --- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateAggregatorFeedTest.php +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateAggregatorFeedTest.php @@ -8,7 +8,7 @@ namespace Drupal\migrate_drupal\Tests\d6; use Drupal\aggregator\Entity\Feed; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\migrate\MigrateExecutable; use Drupal\migrate_drupal\Tests\MigrateDrupalTestBase; @@ -52,7 +52,7 @@ public function testAggregatorFeedImport() { $feed = entity_load('aggregator_feed', 5); $this->assertNotNull($feed->uuid()); $this->assertEqual($feed->title->value, 'Know Your Meme'); - $this->assertEqual($feed->language()->id, Language::LANGCODE_NOT_SPECIFIED); + $this->assertEqual($feed->language()->id, LanguageInterface::LANGCODE_NOT_SPECIFIED); $this->assertEqual($feed->url->value, 'http://knowyourmeme.com/newsfeed.rss'); $this->assertEqual($feed->refresh->value, 900); $this->assertEqual($feed->checked->value, 1387659487); diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateAggregatorItemTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateAggregatorItemTest.php index c5ca816..520dccf 100644 --- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateAggregatorItemTest.php +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateAggregatorItemTest.php @@ -8,7 +8,7 @@ namespace Drupal\migrate_drupal\Tests\d6; use Drupal\aggregator\Entity\Item; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\migrate\MigrateExecutable; use Drupal\migrate_drupal\Tests\MigrateDrupalTestBase; @@ -76,7 +76,7 @@ public function testAggregatorItem() { $this->assertEqual($item->getDescription(), "

What's new with Drupal 8?

"); $this->assertEqual($item->getLink(), 'https://groups.drupal.org/node/395218'); $this->assertEqual($item->getPostedTime(), 1389297196); - $this->assertEqual($item->language()->id, Language::LANGCODE_NOT_SPECIFIED); + $this->assertEqual($item->language()->id, LanguageInterface::LANGCODE_NOT_SPECIFIED); $this->assertEqual($item->getGuid(), '395218 at https://groups.drupal.org'); } diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCommentTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCommentTest.php index 409f6d2..8c7d939 100644 --- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCommentTest.php +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCommentTest.php @@ -8,7 +8,7 @@ namespace Drupal\migrate_drupal\Tests\d6; use Drupal\comment\Entity\Comment; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\migrate\MigrateExecutable; use Drupal\migrate_drupal\Tests\MigrateDrupalTestBase; @@ -76,7 +76,7 @@ public function testComments() { $this->assertEqual(0, $comment->pid->value); $this->assertEqual(1, $comment->entity_id->value); $this->assertEqual('node', $comment->entity_type->value); - $this->assertEqual(Language::LANGCODE_NOT_SPECIFIED, $comment->language()->id); + $this->assertEqual(LanguageInterface::LANGCODE_NOT_SPECIFIED, $comment->language()->id); $comment = entity_load('comment', 2); $this->assertEqual('The response to the second comment.', $comment->subject->value); diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCustomBlockTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCustomBlockTest.php index d48acaf..128dc3c 100644 --- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCustomBlockTest.php +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCustomBlockTest.php @@ -7,7 +7,7 @@ namespace Drupal\migrate_drupal\Tests\d6; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\custom_block\Entity\CustomBlock; use Drupal\migrate\MigrateExecutable; use Drupal\migrate_drupal\Tests\MigrateDrupalTestBase; @@ -59,7 +59,7 @@ public function testBlockMigration() { $this->assertEqual('My block 1', $block->label()); $this->assertEqual(1, $block->getRevisionId()); $this->assertTrue(REQUEST_TIME <= $block->getChangedTime() && $block->getChangedTime() <= time()); - $this->assertEqual(Language::LANGCODE_NOT_SPECIFIED, $block->language()->id); + $this->assertEqual(LanguageInterface::LANGCODE_NOT_SPECIFIED, $block->language()->id); $this->assertEqual('

My first custom block body

', $block->body->value); $this->assertEqual('full_html', $block->body->format); @@ -67,7 +67,7 @@ public function testBlockMigration() { $this->assertEqual('My block 2', $block->label()); $this->assertEqual(2, $block->getRevisionId()); $this->assertTrue(REQUEST_TIME <= $block->getChangedTime() && $block->getChangedTime() <= time()); - $this->assertEqual(Language::LANGCODE_NOT_SPECIFIED, $block->language()->id); + $this->assertEqual(LanguageInterface::LANGCODE_NOT_SPECIFIED, $block->language()->id); $this->assertEqual('

My second custom block body

', $block->body->value); $this->assertEqual('full_html', $block->body->format); } diff --git a/core/modules/node/lib/Drupal/node/Entity/Node.php b/core/modules/node/lib/Drupal/node/Entity/Node.php index 1d21504..44042d4 100644 --- a/core/modules/node/lib/Drupal/node/Entity/Node.php +++ b/core/modules/node/lib/Drupal/node/Entity/Node.php @@ -12,6 +12,7 @@ use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Field\FieldDefinition; use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Session\AccountInterface; use Drupal\node\NodeInterface; use Drupal\user\UserInterface; @@ -163,7 +164,7 @@ public function prepareLangcode() { // Load languages the node exists in. $node_translations = $this->getTranslationLanguages(); // Load the language from content negotiation. - $content_negotiation_langcode = \Drupal::languageManager()->getCurrentLanguage(Language::TYPE_CONTENT)->id; + $content_negotiation_langcode = \Drupal::languageManager()->getCurrentLanguage(LanguageInterface::TYPE_CONTENT)->id; // If there is a translation available, use it. if (isset($node_translations[$content_negotiation_langcode])) { $langcode = $content_negotiation_langcode; diff --git a/core/modules/node/lib/Drupal/node/NodeAccessController.php b/core/modules/node/lib/Drupal/node/NodeAccessController.php index 7b85600..18a3c4b 100644 --- a/core/modules/node/lib/Drupal/node/NodeAccessController.php +++ b/core/modules/node/lib/Drupal/node/NodeAccessController.php @@ -12,6 +12,7 @@ use Drupal\Core\Entity\EntityControllerInterface; use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Entity\EntityAccessController; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\ContentEntityBase; @@ -58,7 +59,7 @@ public static function createInstance(ContainerInterface $container, EntityTypeI /** * {@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) { if (user_access('bypass node access', $account)) { return TRUE; } diff --git a/core/modules/node/lib/Drupal/node/NodeForm.php b/core/modules/node/lib/Drupal/node/NodeForm.php index 37bb7da..6a8c193 100644 --- a/core/modules/node/lib/Drupal/node/NodeForm.php +++ b/core/modules/node/lib/Drupal/node/NodeForm.php @@ -11,7 +11,7 @@ use Drupal\Core\Cache\Cache; use Drupal\Core\Datetime\DrupalDateTime; use Drupal\Core\Entity\ContentEntityForm; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Component\Utility\String; /** @@ -90,7 +90,7 @@ public function form(array $form, array &$form_state) { '#title' => t('Language'), '#type' => 'language_select', '#default_value' => $node->getUntranslated()->language()->id, - '#languages' => Language::STATE_ALL, + '#languages' => LanguageInterface::STATE_ALL, '#access' => isset($language_configuration['language_show']) && $language_configuration['language_show'], ); diff --git a/core/modules/node/lib/Drupal/node/NodeStorage.php b/core/modules/node/lib/Drupal/node/NodeStorage.php index 8bb17fd..55a660c 100644 --- a/core/modules/node/lib/Drupal/node/NodeStorage.php +++ b/core/modules/node/lib/Drupal/node/NodeStorage.php @@ -11,6 +11,7 @@ use Drupal\Core\Entity\ContentEntityDatabaseStorage; use Drupal\Core\Session\AccountInterface; use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; /** * Defines the controller class for nodes. @@ -55,7 +56,7 @@ public function updateType($old_type, $new_type) { */ public function clearRevisionsLanguage($language) { return $this->database->update('node_revision') - ->fields(array('langcode' => Language::LANGCODE_NOT_SPECIFIED)) + ->fields(array('langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED)) ->condition('langcode', $language->id) ->execute(); } diff --git a/core/modules/node/lib/Drupal/node/Plugin/Search/NodeSearch.php b/core/modules/node/lib/Drupal/node/Plugin/Search/NodeSearch.php index 1bcd79b..ecb01d6 100644 --- a/core/modules/node/lib/Drupal/node/Plugin/Search/NodeSearch.php +++ b/core/modules/node/lib/Drupal/node/Plugin/Search/NodeSearch.php @@ -13,7 +13,7 @@ use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\State\StateInterface; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Session\AccountInterface; use Drupal\Core\Access\AccessibleInterface; use Drupal\Core\Database\Query\Condition; @@ -452,7 +452,7 @@ public function searchFormAlter(array &$form, array &$form_state) { // Add languages. $language_options = array(); - $language_list = \Drupal::languageManager()->getLanguages(Language::STATE_ALL); + $language_list = \Drupal::languageManager()->getLanguages(LanguageInterface::STATE_ALL); foreach ($language_list as $langcode => $language) { // Make locked languages appear special in the list. $language_options[$langcode] = $language->locked ? t('- @name -', array('@name' => $language->name)) : $language->name; diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeAccessLanguageTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeAccessLanguageTest.php index feeae45..5eec5d9 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeAccessLanguageTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeAccessLanguageTest.php @@ -8,6 +8,7 @@ namespace Drupal\node\Tests; use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; /** * Verifies node access functionality for multiple languages. @@ -82,7 +83,7 @@ function testNodeAccess() { // Creating a public node with no special langcode, like when no language // module enabled. $node_public_no_language = $this->drupalCreateNode(array('private' => FALSE)); - $this->assertTrue($node_public_no_language->language()->id == Language::LANGCODE_NOT_SPECIFIED, 'Node created with not specified language.'); + $this->assertTrue($node_public_no_language->language()->id == LanguageInterface::LANGCODE_NOT_SPECIFIED, 'Node created with not specified language.'); // Tests that access is granted if requested with no language. $this->assertNodeAccess($expected_node_access, $node_public_no_language, $web_user); diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeCreationTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeCreationTest.php index 540f952..62846cf 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeCreationTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeCreationTest.php @@ -8,7 +8,7 @@ namespace Drupal\node\Tests; use Drupal\Core\Database\Database; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; /** * Tests creating and saving a node. @@ -84,7 +84,7 @@ function testFailedPageCreation() { 'uid' => $this->loggedInUser->id(), 'name' => $this->loggedInUser->name, 'type' => 'page', - 'langcode' => Language::LANGCODE_NOT_SPECIFIED, + 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, 'title' => 'testing_transaction_exception', ); diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeFieldMultilingualTestCase.php b/core/modules/node/lib/Drupal/node/Tests/NodeFieldMultilingualTestCase.php index fd83b93..fee7ba3 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeFieldMultilingualTestCase.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeFieldMultilingualTestCase.php @@ -11,6 +11,7 @@ use Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUrl; use Drupal\simpletest\WebTestBase; use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; /** * Functional test for multilingual fields. @@ -101,7 +102,7 @@ function testMultilingualNodeForm() { $this->assertTrue($node->language()->id == $langcode && $node->body->value == $body_value, 'Field language correctly changed.'); // Enable content language URL detection. - $this->container->get('language_negotiator')->saveConfiguration(Language::TYPE_CONTENT, array(LanguageNegotiationUrl::METHOD_ID => 0)); + $this->container->get('language_negotiator')->saveConfiguration(LanguageInterface::TYPE_CONTENT, array(LanguageNegotiationUrl::METHOD_ID => 0)); // Test multilingual field language fallback logic. $this->drupalGet("it/node/{$node->id()}"); diff --git a/core/modules/node/lib/Drupal/node/Tests/PagePreviewTest.php b/core/modules/node/lib/Drupal/node/Tests/PagePreviewTest.php index 48a8ea6..5137bbd 100644 --- a/core/modules/node/lib/Drupal/node/Tests/PagePreviewTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/PagePreviewTest.php @@ -7,7 +7,7 @@ namespace Drupal\node\Tests; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; /** * Tests the node entity preview functionality. @@ -47,7 +47,7 @@ function setUp() { 'name' => $this->randomName(), 'description' => $this->randomName(), 'vid' => $this->randomName(), - 'langcode' => Language::LANGCODE_NOT_SPECIFIED, + 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, 'help' => '', )); $vocabulary->save(); @@ -59,7 +59,7 @@ function setUp() { 'name' => $this->randomName(), 'description' => $this->randomName(), 'vid' => $this->vocabulary->id(), - 'langcode' => Language::LANGCODE_NOT_SPECIFIED, + 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, )); $term->save(); diff --git a/core/modules/node/node.module b/core/modules/node/node.module index 2253f71..dd2eb56 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -10,6 +10,7 @@ use Drupal\Component\Utility\Xss; use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Render\Element; use Drupal\Core\Url; use Symfony\Component\HttpFoundation\Request; @@ -1033,7 +1034,7 @@ function node_block_access(Block $block, $operation, AccountInterface $account, */ function node_feed($nids = FALSE, $channel = array()) { global $base_url; - $language_content = \Drupal::languageManager()->getCurrentLanguage(Language::TYPE_CONTENT); + $language_content = \Drupal::languageManager()->getCurrentLanguage(LanguageInterface::TYPE_CONTENT); $rss_config = \Drupal::config('system.rss'); if ($nids === FALSE) { diff --git a/core/modules/node/node.tokens.inc b/core/modules/node/node.tokens.inc index 8789047..6a09163 100644 --- a/core/modules/node/node.tokens.inc +++ b/core/modules/node/node.tokens.inc @@ -5,7 +5,7 @@ * Builds placeholder replacement tokens for node-related data. */ -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; /** * Implements hook_token_info(). @@ -94,7 +94,7 @@ function node_tokens($type, $tokens, array $data = array(), array $options = arr $langcode = $options['langcode']; } else { - $langcode = Language::LANGCODE_DEFAULT; + $langcode = LanguageInterface::LANGCODE_DEFAULT; } $sanitize = !empty($options['sanitize']); diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/cache/CachePluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/cache/CachePluginBase.php index 4f2503c..dc69931 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/cache/CachePluginBase.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/cache/CachePluginBase.php @@ -8,7 +8,6 @@ namespace Drupal\views\Plugin\views\cache; use Drupal\Core\Cache\Cache; -use Drupal\Core\Language\Language; use Drupal\views\Plugin\views\PluginBase; use Drupal\Core\Database\Query\Select; diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/AreaEntityTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/AreaEntityTest.php index 5751042..f2a42fc 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Handler/AreaEntityTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Handler/AreaEntityTest.php @@ -8,7 +8,6 @@ namespace Drupal\views\Tests\Handler; use Drupal\Core\Entity\EntityTypeInterface; -use Drupal\Core\Language\Language; use Drupal\views\Tests\ViewTestBase; use Drupal\views\Views; diff --git a/core/modules/views/lib/Drupal/views/ViewAccessController.php b/core/modules/views/lib/Drupal/views/ViewAccessController.php index e761af2..3b22203 100644 --- a/core/modules/views/lib/Drupal/views/ViewAccessController.php +++ b/core/modules/views/lib/Drupal/views/ViewAccessController.php @@ -9,7 +9,6 @@ use Drupal\Core\Entity\EntityAccessController; use Drupal\Core\Entity\EntityInterface; -use Drupal\Core\Language\Language; use Drupal\Core\Session\AccountInterface; /** diff --git a/core/modules/views/views.theme.inc b/core/modules/views/views.theme.inc index 86e3e85..f5d2022 100644 --- a/core/modules/views/views.theme.inc +++ b/core/modules/views/views.theme.inc @@ -7,7 +7,6 @@ use Drupal\Component\Utility\String; use Drupal\Component\Utility\Xss; -use Drupal\Core\Language\Language; use Drupal\Core\Template\Attribute; use Drupal\views\Form\ViewsForm; use Drupal\views\ViewExecutable; diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityManagerTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityManagerTest.php index 677eb18..b7e562e 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityManagerTest.php @@ -18,6 +18,7 @@ use Drupal\Core\Entity\EntityManager; use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Tests\UnitTestCase; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -948,7 +949,7 @@ public function testGetTranslationFromContext() { $entity->expects($this->exactly(2)) ->method('hasTranslation') ->will($this->returnValueMap(array( - array(Language::LANGCODE_DEFAULT, FALSE), + array(LanguageInterface::LANGCODE_DEFAULT, FALSE), array('custom_langcode', TRUE), ))); diff --git a/core/tests/Drupal/Tests/Core/PathProcessor/PathProcessorTest.php b/core/tests/Drupal/Tests/Core/PathProcessor/PathProcessorTest.php index f58edc5..bdcd093 100644 --- a/core/tests/Drupal/Tests/Core/PathProcessor/PathProcessorTest.php +++ b/core/tests/Drupal/Tests/Core/PathProcessor/PathProcessorTest.php @@ -7,7 +7,7 @@ namespace Drupal\Tests\Core\PathProcessor; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\PathProcessor\PathProcessorAlias; use Drupal\Core\PathProcessor\PathProcessorDecode; use Drupal\Core\PathProcessor\PathProcessorFront; @@ -78,7 +78,7 @@ public function setUp() { ->will($this->returnValue($this->languages)); $language_manager->expects($this->any()) ->method('getLanguageTypes') - ->will($this->returnValue(array(Language::TYPE_INTERFACE))); + ->will($this->returnValue(array(LanguageInterface::TYPE_INTERFACE))); $language_manager->expects($this->any()) ->method('getNegotiationMethods') ->will($this->returnValue($method_definitions)); diff --git a/core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php b/core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php index 2953f92..50be0cf 100644 --- a/core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php @@ -8,6 +8,7 @@ namespace Drupal\Tests\Core\Plugin; use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Tests\UnitTestCase; /** @@ -168,7 +169,7 @@ public function testDefaultPluginManagerWithEmptyCache() { $language_manager = $this->getMock('Drupal\Core\Language\LanguageManagerInterface'); $language_manager->expects($this->once()) ->method('getCurrentLanguage') - ->with(Language::TYPE_INTERFACE) + ->with(LanguageInterface::TYPE_INTERFACE) ->will($this->returnValue($language)); $plugin_manager = new TestPluginManager($this->namespaces, $this->expectedDefinitions); @@ -199,7 +200,7 @@ public function testDefaultPluginManagerWithFilledCache() { $language_manager = $this->getMock('Drupal\Core\Language\LanguageManagerInterface'); $language_manager->expects($this->once()) ->method('getCurrentLanguage') - ->with(Language::TYPE_INTERFACE) + ->with(LanguageInterface::TYPE_INTERFACE) ->will($this->returnValue($language)); $plugin_manager = new TestPluginManager($this->namespaces, $this->expectedDefinitions); @@ -230,7 +231,7 @@ public function testCacheClearWithTags() { $language_manager = $this->getMock('Drupal\Core\Language\LanguageManagerInterface'); $language_manager->expects($this->once()) ->method('getCurrentLanguage') - ->with(Language::TYPE_INTERFACE) + ->with(LanguageInterface::TYPE_INTERFACE) ->will($this->returnValue($language)); $plugin_manager = new TestPluginManager($this->namespaces, $this->expectedDefinitions); diff --git a/core/tests/Drupal/Tests/Core/Utility/TokenTest.php b/core/tests/Drupal/Tests/Core/Utility/TokenTest.php index f92502e..2f67a7b 100644 --- a/core/tests/Drupal/Tests/Core/Utility/TokenTest.php +++ b/core/tests/Drupal/Tests/Core/Utility/TokenTest.php @@ -7,7 +7,7 @@ namespace Drupal\Tests\Core\Utility; -use Drupal\Core\Language\Language; +use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Utility\Token; use Drupal\Tests\UnitTestCase; @@ -87,7 +87,7 @@ public function testGetInfo() { $this->languageManager->expects($this->once()) ->method('getCurrentLanguage') - ->with(Language::TYPE_CONTENT) + ->with(LanguageInterface::TYPE_CONTENT) ->will($this->returnValue($language)); // The persistent cache must only be hit once, after which the info is