diff --git a/core/modules/hal/lib/Drupal/hal/Normalizer/ContentEntityNormalizer.php b/core/modules/hal/lib/Drupal/hal/Normalizer/ContentEntityNormalizer.php index f374fa3..e77be11 100644 --- a/core/modules/hal/lib/Drupal/hal/Normalizer/ContentEntityNormalizer.php +++ b/core/modules/hal/lib/Drupal/hal/Normalizer/ContentEntityNormalizer.php @@ -126,21 +126,15 @@ public function denormalize($data, $class, $format = NULL, array $context = arra // Create the entity. $typed_data_ids = $this->getTypedDataIds($data['_links']['type']); + $values = array(); // Figure out the language to use. if (isset($data['langcode'])) { - $langcode = $data['langcode'][0]['value']; + $values['langcode'] = $data['langcode'][0]['value']; // Remove the langcode so it does not get iterated over below. unset($data['langcode']); } - elseif ($this->moduleHandler->moduleExists('language')) { - $langcode = language_get_default_langcode($typed_data_ids['entity_type'], $typed_data_ids['bundle']); - } - else { - $langcode = Language::LANGCODE_NOT_SPECIFIED; - } $entity_type = $this->entityManager->getDefinition($typed_data_ids['entity_type']); - $values = array('langcode' => $langcode); if ($entity_type->hasKey('bundle')) { $bundle_key = $entity_type->getKey('bundle'); diff --git a/core/modules/node/lib/Drupal/node/Controller/NodeController.php b/core/modules/node/lib/Drupal/node/Controller/NodeController.php index b16b93d..d0b74ed 100644 --- a/core/modules/node/lib/Drupal/node/Controller/NodeController.php +++ b/core/modules/node/lib/Drupal/node/Controller/NodeController.php @@ -63,13 +63,11 @@ public function addPage() { */ public function add(NodeTypeInterface $node_type) { $account = $this->currentUser(); - $langcode = $this->moduleHandler()->invoke('language', 'get_default_langcode', array('node', $node_type->type)); $node = $this->entityManager()->getStorage('node')->create(array( 'uid' => $account->id(), 'name' => $account->getUsername() ?: '', 'type' => $node_type->type, - 'langcode' => $langcode ? $langcode : $this->languageManager()->getCurrentLanguage()->id, )); $form = $this->entityFormBuilder()->getForm($node); diff --git a/core/modules/shortcut/lib/Drupal/shortcut/Controller/ShortcutController.php b/core/modules/shortcut/lib/Drupal/shortcut/Controller/ShortcutController.php index 8f3b481..943caa0 100644 --- a/core/modules/shortcut/lib/Drupal/shortcut/Controller/ShortcutController.php +++ b/core/modules/shortcut/lib/Drupal/shortcut/Controller/ShortcutController.php @@ -9,7 +9,6 @@ use Drupal\Core\Controller\ControllerBase; use Drupal\shortcut\ShortcutSetInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; /** * Provides route responses for taxonomy.module. @@ -28,9 +27,6 @@ class ShortcutController extends ControllerBase { */ public function addForm(ShortcutSetInterface $shortcut_set) { $shortcut = $this->entityManager()->getStorage('shortcut')->create(array('shortcut_set' => $shortcut_set->id())); - if ($this->moduleHandler()->moduleExists('language')) { - $shortcut->langcode = language_get_default_langcode('shortcut', $shortcut_set->id()); - } return $this->entityFormBuilder()->getForm($shortcut, 'add'); } diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Controller/TaxonomyController.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Controller/TaxonomyController.php index 0312a9d..0ddbce4 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Controller/TaxonomyController.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Controller/TaxonomyController.php @@ -11,7 +11,6 @@ use Drupal\Core\Controller\ControllerBase; use Drupal\taxonomy\TermInterface; use Drupal\taxonomy\VocabularyInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; /** * Provides route responses for taxonomy.module. @@ -29,9 +28,6 @@ class TaxonomyController extends ControllerBase { */ public function addForm(VocabularyInterface $taxonomy_vocabulary) { $term = $this->entityManager()->getStorage('taxonomy_term')->create(array('vid' => $taxonomy_vocabulary->id())); - if ($this->moduleHandler()->moduleExists('language')) { - $term->langcode = language_get_default_langcode('taxonomy_term', $taxonomy_vocabulary->id()); - } return $this->entityFormBuilder()->getForm($term); } diff --git a/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php b/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php index 6c73639..a9700bd 100644 --- a/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php @@ -8,7 +8,6 @@ namespace Drupal\Tests\Core\Entity; use Drupal\Core\DependencyInjection\ContainerBuilder; -use Drupal\Core\Extension\ModuleHandler; use Drupal\Tests\UnitTestCase; use Drupal\Core\Language\Language; @@ -69,13 +68,6 @@ class ContentEntityBaseUnitTest extends UnitTestCase { protected $languageManager; /** - * The module handler. - * - * @var \Drupal\Core\Extension\ModuleHandlerInterface|\PHPUnit_Framework_MockObject_MockObject - */ - protected $moduleHandler; - - /** * The UUID generator used for testing. * * @var \Drupal\Component\Uuid\UuidInterface|\PHPUnit_Framework_MockObject_MockObject @@ -144,17 +136,12 @@ public function setUp() { ->method('getLanguage') ->with('en') ->will($this->returnValue($language)); - $this->moduleHandler = $this->getMock('\Drupal\Core\Extension\ModuleHandlerInterface'); - $this->moduleHandler->expects($this->any()) - ->method('module_exists') - ->with('language') - ->will($this->returnValue(FALSE)); + $container = new ContainerBuilder(); $container->set('entity.manager', $this->entityManager); $container->set('uuid', $this->uuid); $container->set('typed_data_manager', $this->typedDataManager); $container->set('language_manager', $this->languageManager); - $container->set('module_handler', $this->moduleHandler); \Drupal::setContainer($container); $this->entity = $this->getMockForAbstractClass('\Drupal\Core\Entity\ContentEntityBase', array($values, $this->entityTypeId, $this->bundle));