Commit 10341f43 authored by webchick's avatar webchick

Issue #2328161 by alexpott, vijaycs85 | Sutharsan: Fixed 'Enable Translation'...

Issue #2328161 by alexpott, vijaycs85 | Sutharsan: Fixed 'Enable Translation' checkbox default non-predictable for new bundles.
parent 5d730a04
......@@ -650,7 +650,9 @@ function content_translation_language_configuration_element_process(array $eleme
$element['content_translation'] = array(
'#type' => 'checkbox',
'#title' => t('Enable translation'),
'#default_value' => content_translation_enabled($context['entity_type'], $context['bundle']),
// For new bundle, we don't know the bundle name yet,
// default to no translatability.
'#default_value' => $context['bundle'] ? content_translation_enabled($context['entity_type'], $context['bundle']) : FALSE,
'#element_validate' => array('content_translation_language_configuration_element_validate'),
'#prefix' => '<label>' . t('Translation') . '</label>',
);
......
<?php
/**
* @file
* Contains \Drupal\entity\Tests\ContentTranslationEntityBundleUITest.
*/
namespace Drupal\content_translation\Tests;
use Drupal\simpletest\WebTestBase;
/**
* Tests the content translation behaviours on entity bundle UI.
*
* @group content_translation
*/
class ContentTranslationEntityBundleUITest extends WebTestBase {
public static $modules = array('language', 'content_translation', 'node', 'comment', 'field_ui');
protected function setUp() {
parent::setUp();
$user = $this->drupalCreateUser(array('access administration pages', 'administer languages', 'administer content translation', 'administer content types'));
$this->drupalLogin($user);
}
/**
* Tests content types default translation behaviour.
*/
public function testContentTypeUI() {
// Create first content type.
$this->drupalCreateContentType(array('type' => 'article'));
// Enable content translation.
$edit = array('language_configuration[content_translation]' => TRUE);
$this->drupalPostForm('admin/structure/types/manage/article', $edit, 'Save content type');
// Make sure add page does not inherit translation configuration from first
// content type.
$this->drupalGet('admin/structure/types/add');
$this->assertNoFieldChecked('edit-language-configuration-content-translation');
}
}
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