Issue #2105407 by swentel, plach: Fixed Changing language settings for fields ends in a fatal error.
parent
abea2891b8
commit
605ed74f83
|
@ -810,9 +810,9 @@ function content_translation_form_field_ui_field_edit_form_alter(array &$form, a
|
||||||
* Implements hook_form_FORM_ID_alter() for 'field_ui_field_instance_edit_form'.
|
* Implements hook_form_FORM_ID_alter() for 'field_ui_field_instance_edit_form'.
|
||||||
*/
|
*/
|
||||||
function content_translation_form_field_ui_field_instance_edit_form_alter(array &$form, array &$form_state, $form_id) {
|
function content_translation_form_field_ui_field_instance_edit_form_alter(array &$form, array &$form_state, $form_id) {
|
||||||
if ($form['#instance']->isFieldTranslatable()) {
|
if ($form['#field']->isFieldTranslatable()) {
|
||||||
module_load_include('inc', 'content_translation', 'content_translation.admin');
|
module_load_include('inc', 'content_translation', 'content_translation.admin');
|
||||||
$element = content_translation_field_sync_widget($form['#instance']);
|
$element = content_translation_field_sync_widget($form['#field']);
|
||||||
if ($element) {
|
if ($element) {
|
||||||
$form['instance']['settings']['translation_sync'] = $element;
|
$form['instance']['settings']['translation_sync'] = $element;
|
||||||
}
|
}
|
||||||
|
@ -997,7 +997,7 @@ function content_translation_save_settings($settings) {
|
||||||
// If the field does not have translatable enabled we need to reset
|
// If the field does not have translatable enabled we need to reset
|
||||||
// the sync settings to their defaults.
|
// the sync settings to their defaults.
|
||||||
else {
|
else {
|
||||||
unset($instance['settings']['translation_sync']);
|
unset($instance->settings['translation_sync']);
|
||||||
}
|
}
|
||||||
$instance->save();
|
$instance->save();
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ class ContentTranslationSyncImageTest extends ContentTranslationTestBase {
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public static $modules = array('language', 'content_translation', 'entity_test', 'image');
|
public static $modules = array('language', 'content_translation', 'entity_test', 'image', 'field_ui');
|
||||||
|
|
||||||
public static function getInfo() {
|
public static function getInfo() {
|
||||||
return array(
|
return array(
|
||||||
|
@ -79,10 +79,43 @@ class ContentTranslationSyncImageTest extends ContentTranslationTestBase {
|
||||||
))->save();
|
))->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
protected function getEditorPermissions() {
|
||||||
|
// Every entity-type-specific test needs to define these.
|
||||||
|
return array('administer entity_test_mul fields', 'administer languages', 'administer content translation');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests image field field synchronization.
|
* Tests image field field synchronization.
|
||||||
*/
|
*/
|
||||||
function testImageFieldSync() {
|
function testImageFieldSync() {
|
||||||
|
// Check that the alt and title fields are enabled for the image field.
|
||||||
|
$this->drupalLogin($this->editor);
|
||||||
|
$this->drupalGet('entity_test_mul/structure/' . $this->entityType . '/fields/' . $this->entityType . '.' . $this->entityType . '.' . $this->fieldName);
|
||||||
|
$this->assertFieldChecked('edit-instance-settings-translation-sync-alt');
|
||||||
|
$this->assertFieldChecked('edit-instance-settings-translation-sync-title');
|
||||||
|
$edit = array(
|
||||||
|
'instance[settings][translation_sync][alt]' => FALSE,
|
||||||
|
'instance[settings][translation_sync][title]' => FALSE,
|
||||||
|
);
|
||||||
|
$this->drupalPostForm(NULL, $edit, t('Save settings'));
|
||||||
|
|
||||||
|
// Check that the content translation settings page reflects the changes
|
||||||
|
// performed in the field edit page.
|
||||||
|
$this->drupalGet('admin/config/regional/content-language');
|
||||||
|
$this->assertNoFieldChecked('edit-settings-entity-test-mul-entity-test-mul-columns-field-test-et-ui-image-alt');
|
||||||
|
$this->assertNoFieldChecked('edit-settings-entity-test-mul-entity-test-mul-columns-field-test-et-ui-image-title');
|
||||||
|
$edit = array(
|
||||||
|
'settings[entity_test_mul][entity_test_mul][columns][field_test_et_ui_image][alt]' => TRUE,
|
||||||
|
'settings[entity_test_mul][entity_test_mul][columns][field_test_et_ui_image][title]' => TRUE,
|
||||||
|
);
|
||||||
|
$this->drupalPostForm('admin/config/regional/content-language', $edit, t('Save'));
|
||||||
|
$this->assertFieldChecked('edit-settings-entity-test-mul-entity-test-mul-columns-field-test-et-ui-image-alt');
|
||||||
|
$this->assertFieldChecked('edit-settings-entity-test-mul-entity-test-mul-columns-field-test-et-ui-image-title');
|
||||||
|
$this->drupalLogin($this->translator);
|
||||||
|
|
||||||
$default_langcode = $this->langcodes[0];
|
$default_langcode = $this->langcodes[0];
|
||||||
$langcode = $this->langcodes[1];
|
$langcode = $this->langcodes[1];
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,8 @@ use Drupal\Core\Annotation\Translation;
|
||||||
* "uuid" = "uuid",
|
* "uuid" = "uuid",
|
||||||
* "bundle" = "type"
|
* "bundle" = "type"
|
||||||
* },
|
* },
|
||||||
* menu_base_path = "entity_test_mul/manage/%entity_test_mul"
|
* menu_base_path = "entity_test_mul/manage/%entity_test_mul",
|
||||||
|
* route_base_path = "entity_test_mul/structure/{bundle}"
|
||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
class EntityTestMul extends EntityTest {
|
class EntityTestMul extends EntityTest {
|
||||||
|
|
Loading…
Reference in New Issue