Commit 96ed8ac5 authored by alexpott's avatar alexpott

Issue #2723555 by valthebald: Remove entity_load* usage for configurable_language entity type

parent f0e50041
......@@ -1572,7 +1572,7 @@ function install_download_additional_translations_operations(&$install_state) {
\Drupal::moduleHandler()->loadInclude('locale', 'bulk.inc');
$langcode = $install_state['parameters']['langcode'];
if (!($language = entity_load('configurable_language', $langcode))) {
if (!($language = ConfigurableLanguage::load($langcode))) {
// Create the language if not already shipped with a profile.
$language = ConfigurableLanguage::createFromLangcode($langcode);
}
......
......@@ -109,7 +109,7 @@ public function testDefaultLangcode() {
// Site's default.
$old_default = \Drupal::languageManager()->getDefaultLanguage();
// Ensure the language entity default value is correct.
$configurable_language = entity_load('configurable_language', $old_default->getId());
$configurable_language = ConfigurableLanguage::load($old_default->getId());
$this->assertTrue($configurable_language->isDefault(), 'The en language entity is flagged as the default language.');
$this->config('system.site')->set('default_langcode', 'cc')->save();
......@@ -121,9 +121,9 @@ public function testDefaultLangcode() {
$this->assertEqual($langcode, 'cc');
// Ensure the language entity default value is correct.
$configurable_language = entity_load('configurable_language', $old_default->getId());
$configurable_language = ConfigurableLanguage::load($old_default->getId());
$this->assertFalse($configurable_language->isDefault(), 'The en language entity is not flagged as the default language.');
$configurable_language = entity_load('configurable_language', 'cc');
$configurable_language = ConfigurableLanguage::load('cc');
// Check calling the
// \Drupal\language\ConfigurableLanguageInterface::isDefault() method
// directly.
......
......@@ -204,8 +204,11 @@ protected function checkConfigurableLanguageWeight($state = 'by default') {
protected function getHighestConfigurableLanguageWeight(){
$max_weight = 0;
$storage = $this->container->get('entity_type.manager')
->getStorage('configurable_language');
$storage->resetCache();
/* @var $languages \Drupal\Core\Language\LanguageInterface[] */
$languages = entity_load_multiple('configurable_language', NULL, TRUE);
$languages = $storage->loadMultiple();
foreach ($languages as $language) {
if (!$language->isLocked()) {
$max_weight = max($max_weight, $language->getWeight());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment