Commit 6cfaed4a authored by alexpott's avatar alexpott

Issue #2014955 by YesCT, penyaskito, kfritsche, balintcsaba: Deleted bundles...

Issue #2014955 by YesCT, penyaskito, kfritsche, balintcsaba: Deleted bundles do not have their language configuration deleted
parent 2524d8d5
......@@ -237,6 +237,17 @@ function language_entity_bundle_rename($entity_type_id, $bundle_old, $bundle_new
* Implements hook_entity_bundle_delete().
function language_entity_bundle_delete($entity_type_id, $bundle) {
// Remove the content language settings associated with the bundle.
$settings = ContentLanguageSettings::loadByEntityTypeBundle($entity_type_id, $bundle);
if (!$settings->isNew()) {
* Returns the default language code assigned to an entity type and a bundle.
......@@ -184,6 +184,41 @@ public function testNodeTypeUpdate() {
$this->assertEqual($configuration->uuid(), $uuid, 'The language configuration uuid has been kept on the new Article content type.');
* Tests the language settings are deleted on bundle delete.
public function testNodeTypeDelete() {
// Create the article content type first if the profile used is not the
// standard one.
if ($this->profile != 'standard') {
'type' => 'article',
'name' => 'Article'
$admin_user = $this->drupalCreateUser(array('administer content types'));
// Create language configuration for the articles.
$edit = array(
'language_configuration[langcode]' => 'authors_default',
'language_configuration[language_alterable]' => TRUE,
$this->drupalPostForm('admin/structure/types/manage/article', $edit, t('Save content type'));
// Check the language default configuration for articles is present.
$configuration = \Drupal::entityManager()->getStorage('language_content_settings')->load('node.article');
$this->assertTrue($configuration, 'The language configuration is present.');
// Delete 'article' bundle.
$this->drupalPostForm('admin/structure/types/manage/article/delete', array(), t('Delete'));
// Check that the language configuration has been deleted.
$configuration = \Drupal::entityManager()->getStorage('language_content_settings')->load('node.article');
$this->assertFalse($configuration, 'The language configuration was deleted after bundle was deleted.');
* Tests that the configuration is updated when a vocabulary is changed.
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