Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
de3558c2
Commit
de3558c2
authored
Jun 25, 2013
by
Alex Pott
Browse files
Issue
#2024867
by vijaycs85: Rename translation_entity() to content_translation().
parent
a9b5c816
Changes
57
Expand all
Hide whitespace changes
Inline
Side-by-side
core/lib/Drupal/Core/Entity/Annotation/EntityType.php
View file @
de3558c2
...
...
@@ -63,7 +63,7 @@ class EntityType extends Plugin {
* Defaults to \Drupal\Core\Entity\EntityAccessController.
* - translation: The name of the controller class that should be used to
* handle the translation process. The class must implement
* \Drupal\translation
_entity\Entity
TranslationControllerInterface.
* \Drupal\
content_
translation
\Content
TranslationControllerInterface.
*
* @todo Interfaces from outside \Drupal\Core or \Drupal\Component should not
* be used here.
...
...
@@ -148,7 +148,7 @@ class EntityType extends Plugin {
public
$translatable
=
FALSE
;
/**
* @todo translation_entity_
entity_
info_alter() uses this but it is undocumented.
* @todo
content_
translation_entity_info_alter() uses this but it is undocumented.
*
* @var array
*/
...
...
core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockTranslationController.php
View file @
de3558c2
...
...
@@ -8,22 +8,22 @@
namespace
Drupal\custom_block
;
use
Drupal\Core\Entity\EntityInterface
;
use
Drupal\translation
_entity
\
Entity
TranslationControllerNG
;
use
Drupal\
content_
translation
\
Content
TranslationControllerNG
;
/**
* Defines the translation controller class for custom blocks.
*/
class
CustomBlockTranslationController
extends
Entity
TranslationControllerNG
{
class
CustomBlockTranslationController
extends
Content
TranslationControllerNG
{
/**
* Overrides
Entity
TranslationController::getAccess().
* Overrides
Content
TranslationController::getAccess().
*/
public
function
getAccess
(
EntityInterface
$entity
,
$op
)
{
return
user_access
(
'administer blocks'
);
}
/**
* Overrides
Entity
TranslationController::entityFormAlter().
* Overrides
Content
TranslationController::entityFormAlter().
*/
public
function
entityFormAlter
(
array
&
$form
,
array
&
$form_state
,
EntityInterface
$entity
)
{
parent
::
entityFormAlter
(
$form
,
$form_state
,
$entity
);
...
...
@@ -40,7 +40,7 @@ public function entityFormAlter(array &$form, array &$form_state, EntityInterfac
}
/**
* Overrides
Entity
TranslationController::entityFormTitle().
* Overrides
Content
TranslationController::entityFormTitle().
*/
protected
function
entityFormTitle
(
EntityInterface
$entity
)
{
$block_type
=
entity_load
(
'custom_block_type'
,
$entity
->
type
->
value
);
...
...
core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockTypeFormController.php
View file @
de3558c2
...
...
@@ -52,7 +52,7 @@ public function form(array $form, array &$form_state) {
'#description'
=>
t
(
'Create a new revision by default for this block type.'
)
);
if
(
module_exists
(
'translation
_entity
'
))
{
if
(
module_exists
(
'
content_
translation'
))
{
$form
[
'language'
]
=
array
(
'#type'
=>
'details'
,
'#title'
=>
t
(
'Language settings'
),
...
...
core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockTranslationUITest.php
View file @
de3558c2
...
...
@@ -7,13 +7,13 @@
namespace
Drupal\custom_block\Tests
;
use
Drupal\translation
_entity
\
Tests\Entity
TranslationUITest
;
use
Drupal\
content_
translation
\
Tests\Content
TranslationUITest
;
use
Drupal\custom_block
\
Plugin\Core\Entity\CustomBlock
;
/**
* Tests the Custom Block Translation UI.
*/
class
CustomBlockTranslationUITest
extends
Entity
TranslationUITest
{
class
CustomBlockTranslationUITest
extends
Content
TranslationUITest
{
/**
* The name of the test block.
...
...
@@ -27,7 +27,7 @@ class CustomBlockTranslationUITest extends EntityTranslationUITest {
*/
public
static
$modules
=
array
(
'language'
,
'translation
_entity
'
,
'
content_
translation'
,
'block'
,
'field_ui'
,
'custom_block'
...
...
@@ -56,7 +56,7 @@ public function setUp() {
}
/**
* Overrides \Drupal\translation
_entity\Tests\Entity
TranslationUITest::getTranslatorPermission().
* Overrides \Drupal\
content_
translation
\Tests\Content
TranslationUITest::getTranslatorPermission().
*/
public
function
getTranslatorPermissions
()
{
return
array_merge
(
parent
::
getTranslatorPermissions
(),
array
(
...
...
@@ -93,7 +93,7 @@ protected function createCustomBlock($title = FALSE, $bundle = FALSE) {
}
/**
* Overrides \Drupal\translation
_entity\Tests\Entity
TranslationUITest::getNewEntityValues().
* Overrides \Drupal\
content_
translation
\Tests\Content
TranslationUITest::getNewEntityValues().
*/
protected
function
getNewEntityValues
(
$langcode
)
{
return
array
(
'info'
=>
$this
->
name
)
+
parent
::
getNewEntityValues
(
$langcode
);
...
...
@@ -117,8 +117,8 @@ public function testDisabledBundle() {
$disabled_custom_block
=
$this
->
createCustomBlock
(
FALSE
,
$bundle
->
id
());
// Make sure that only a single row was inserted into the
// {translation
_entity
} table.
$rows
=
db_query
(
'SELECT * FROM {translation
_entity
}'
)
->
fetchAll
();
// {
content_
translation} table.
$rows
=
db_query
(
'SELECT * FROM {
content_
translation}'
)
->
fetchAll
();
$this
->
assertEqual
(
1
,
count
(
$rows
));
$this
->
assertEqual
(
$enabled_custom_block
->
id
(),
reset
(
$rows
)
->
entity_id
);
}
...
...
core/modules/comment/comment.admin.inc
View file @
de3558c2
...
...
@@ -139,7 +139,7 @@ function comment_admin_overview($form, &$form_state, $arg) {
'href'
=>
'comment/'
.
$comment
->
id
()
.
'/edit'
,
'query'
=>
$destination
,
);
if
(
module_invoke
(
'translation
_entity
'
,
'translate_access'
,
$comment
))
{
if
(
module_invoke
(
'
content_
translation'
,
'translate_access'
,
$comment
))
{
$links
[
'translate'
]
=
array
(
'title'
=>
t
(
'translate'
),
'href'
=>
'comment/'
.
$comment
->
id
()
.
'/translations'
,
...
...
core/modules/comment/comment.module
View file @
de3558c2
...
...
@@ -954,7 +954,7 @@ function comment_links(Comment $comment, EntityInterface $node) {
}
// Add translations link for translation-enabled comment bundles.
if
(
module_exists
(
'translation
_entity'
)
&&
translation_
entity_
translate_access
(
$comment
))
{
if
(
module_exists
(
'
content_
translation
'
)
&&
content_
translation_translate_access
(
$comment
))
{
$links
[
'comment-translations'
]
=
array
(
'title'
=>
t
(
'translate'
),
'href'
=>
'comment/'
.
$comment
->
id
()
.
'/translations'
,
...
...
@@ -1059,10 +1059,10 @@ function comment_form_node_type_form_alter(&$form, $form_state) {
),
);
// @todo Remove this check once language settings are generalized.
if
(
module_exists
(
'translation
_entity
'
))
{
if
(
module_exists
(
'
content_
translation'
))
{
$comment_form
=
$form
;
$comment_form_state
[
'translation
_entity
'
][
'key'
]
=
'language_configuration'
;
$form
[
'comment'
]
+=
translation_
entity_
enable_widget
(
'comment'
,
'comment_node_'
.
$form
[
'#node_type'
]
->
type
,
$comment_form
,
$comment_form_state
);
$comment_form_state
[
'
content_
translation'
][
'key'
]
=
'language_configuration'
;
$form
[
'comment'
]
+=
content_
translation_enable_widget
(
'comment'
,
'comment_node_'
.
$form
[
'#node_type'
]
->
type
,
$comment_form
,
$comment_form_state
);
array_unshift
(
$form
[
'#submit'
],
'comment_translation_configuration_element_submit'
);
}
}
...
...
@@ -1083,11 +1083,11 @@ function comment_translation_configuration_element_submit($form, &$form_state) {
// settings.
$key
=
'language_configuration'
;
$comment_form_state
=
array
(
'translation
_entity
'
=>
array
(
'key'
=>
$key
),
'
content_
translation'
=>
array
(
'key'
=>
$key
),
'language'
=>
array
(
$key
=>
array
(
'entity_type'
=>
'comment'
,
'bundle'
=>
'comment_node_'
.
$form
[
'#node_type'
]
->
type
)),
'values'
=>
array
(
$key
=>
array
(
'translation
_entity
'
=>
$form_state
[
'values'
][
'translation
_entity
'
])),
'values'
=>
array
(
$key
=>
array
(
'
content_
translation'
=>
$form_state
[
'values'
][
'
content_
translation'
])),
);
translation_
entity_
language_configuration_element_submit
(
$form
,
$comment_form_state
);
content_
translation_language_configuration_element_submit
(
$form
,
$comment_form_state
);
}
/**
...
...
core/modules/comment/comment.views.inc
View file @
de3558c2
...
...
@@ -360,12 +360,12 @@ function comment_views_data() {
),
);
if
(
Drupal
::
moduleHandler
()
->
moduleExists
(
'translation
_entity
'
))
{
if
(
Drupal
::
moduleHandler
()
->
moduleExists
(
'
content_
translation'
))
{
$data
[
'comment'
][
'translation_link'
]
=
array
(
'title'
=>
t
(
'Translation link'
),
'help'
=>
t
(
'Provide a link to the translations overview for comments.'
),
'field'
=>
array
(
'id'
=>
'translation_
entity_
link'
,
'id'
=>
'
content_
translation_link'
,
),
);
}
...
...
core/modules/comment/lib/Drupal/comment/CommentTranslationController.php
View file @
de3558c2
...
...
@@ -9,15 +9,15 @@
namespace
Drupal\comment
;
use
Drupal\Core\Entity\EntityInterface
;
use
Drupal\translation
_entity
\
Entity
TranslationControllerNG
;
use
Drupal\
content_
translation
\
Content
TranslationControllerNG
;
/**
* Defines the translation controller class for comments.
*/
class
CommentTranslationController
extends
Entity
TranslationControllerNG
{
class
CommentTranslationController
extends
Content
TranslationControllerNG
{
/**
* Overrides
Entity
TranslationController::entityFormTitle().
* Overrides
Content
TranslationController::entityFormTitle().
*/
protected
function
entityFormTitle
(
EntityInterface
$entity
)
{
return
t
(
'Edit comment @subject'
,
array
(
'@subject'
=>
$entity
->
label
()));
...
...
core/modules/comment/lib/Drupal/comment/Tests/CommentTranslationUITest.php
View file @
de3558c2
...
...
@@ -7,12 +7,12 @@
namespace
Drupal\comment\Tests
;
use
Drupal\translation
_entity
\
Tests\Entity
TranslationUITest
;
use
Drupal\
content_
translation
\
Tests\Content
TranslationUITest
;
/**
* Tests the Comment Translation UI.
*/
class
CommentTranslationUITest
extends
Entity
TranslationUITest
{
class
CommentTranslationUITest
extends
Content
TranslationUITest
{
/**
* The subject of the test comment.
...
...
@@ -24,7 +24,7 @@ class CommentTranslationUITest extends EntityTranslationUITest {
*
* @var array
*/
public
static
$modules
=
array
(
'language'
,
'translation
_entity
'
,
'node'
,
'comment'
);
public
static
$modules
=
array
(
'language'
,
'
content_
translation'
,
'node'
,
'comment'
);
public
static
function
getInfo
()
{
return
array
(
...
...
@@ -44,7 +44,7 @@ function setUp() {
}
/**
* Overrides \Drupal\translation
_entity\Tests\Entity
TranslationUITest::setupBundle().
* Overrides \Drupal\
content_
translation
\Tests\Content
TranslationUITest::setupBundle().
*/
function
setupBundle
()
{
parent
::
setupBundle
();
...
...
@@ -52,14 +52,14 @@ function setupBundle() {
}
/**
* Overrides \Drupal\translation
_entity\Tests\Entity
TranslationUITest::getTranslatorPermission().
* Overrides \Drupal\
content_
translation
\Tests\Content
TranslationUITest::getTranslatorPermission().
*/
protected
function
getTranslatorPermissions
()
{
return
array_merge
(
parent
::
getTranslatorPermissions
(),
array
(
'post comments'
,
'administer comments'
));
}
/**
* Overrides \Drupal\translation
_entity\Tests\Entity
TranslationUITest::setupTestFields().
* Overrides \Drupal\
content_
translation
\Tests\Content
TranslationUITest::setupTestFields().
*/
function
setupTestFields
()
{
parent
::
setupTestFields
();
...
...
@@ -69,7 +69,7 @@ function setupTestFields() {
}
/**
* Overrides \Drupal\translation
_entity\Tests\Entity
TranslationUITest::createEntity().
* Overrides \Drupal\
content_
translation
\Tests\Content
TranslationUITest::createEntity().
*/
protected
function
createEntity
(
$values
,
$langcode
,
$node_bundle
=
NULL
)
{
if
(
!
isset
(
$node_bundle
))
{
...
...
@@ -82,7 +82,7 @@ protected function createEntity($values, $langcode, $node_bundle = NULL) {
}
/**
* Overrides \Drupal\translation
_entity\Tests\Entity
TranslationUITest::getNewEntityValues().
* Overrides \Drupal\
content_
translation
\Tests\Content
TranslationUITest::getNewEntityValues().
*/
protected
function
getNewEntityValues
(
$langcode
)
{
// Comment subject is not translatable hence we use a fixed value.
...
...
@@ -93,7 +93,7 @@ protected function getNewEntityValues($langcode) {
}
/**
* Overrides \Drupal\translation
_entity\Tests\Entity
TranslationUITest::assertPublishedStatus().
* Overrides \Drupal\
content_
translation
\Tests\Content
TranslationUITest::assertPublishedStatus().
*/
protected
function
assertPublishedStatus
()
{
parent
::
assertPublishedStatus
();
...
...
core/modules/translation
_entity/
translation
_entity
.admin.inc
→
core/modules/
content_
translation
/content_
translation.admin.inc
View file @
de3558c2
...
...
@@ -2,7 +2,7 @@
/**
* @file
* The ent
ity
translation administration forms.
* The
cont
ent translation administration forms.
*/
use
Drupal\Core\Entity\EntityInterface
;
...
...
@@ -21,7 +21,7 @@
* @return array
* A form element to configure field synchronization.
*/
function
translation_
entity_
field_sync_widget
(
Field
$field
,
FieldInstance
$instance
)
{
function
content_
translation_field_sync_widget
(
Field
$field
,
FieldInstance
$instance
)
{
$element
=
array
();
if
(
!
empty
(
$field
[
'settings'
][
'column_groups'
])
&&
count
(
$field
[
'settings'
][
'column_groups'
])
>
1
)
{
...
...
@@ -42,10 +42,10 @@ function translation_entity_field_sync_widget(Field $field, FieldInstance $insta
'#default_value'
=>
!
empty
(
$instance
[
'settings'
][
'translation_sync'
])
?
$instance
[
'settings'
][
'translation_sync'
]
:
$default
,
'#attached'
=>
array
(
'library'
=>
array
(
array
(
'translation
_entity
'
,
'drupal.translation
_entity
.admin'
),
array
(
'
content_
translation'
,
'drupal.
content_
translation.admin'
),
),
'js'
=>
array
(
array
(
'data'
=>
array
(
'
t
ranslation
Entity
DependentOptions'
=>
$settings
),
'type'
=>
'setting'
),
array
(
'data'
=>
array
(
'
contentT
ranslationDependentOptions'
=>
$settings
),
'type'
=>
'setting'
),
),
),
);
...
...
@@ -57,21 +57,21 @@ function translation_entity_field_sync_widget(Field $field, FieldInstance $insta
/**
* (proxied) Implements hook_form_FORM_ID_alter().
*/
function
_translation_
entity_
form_language_content_settings_form_alter
(
array
&
$form
,
array
&
$form_state
)
{
function
_content
_translation_form_language_content_settings_form_alter
(
array
&
$form
,
array
&
$form_state
)
{
// Inject into the content language settings the translation settings if the
// user has the required permission.
if
(
!
user_access
(
'administer ent
ity
translation'
))
{
if
(
!
user_access
(
'administer
cont
ent translation'
))
{
return
;
}
$default
=
$form
[
'entity_types'
][
'#default_value'
];
foreach
(
$default
as
$entity_type
=>
$enabled
)
{
$default
[
$entity_type
]
=
$enabled
||
translation_
entity_
enabled
(
$entity_type
)
?
$entity_type
:
FALSE
;
$default
[
$entity_type
]
=
$enabled
||
content_
translation_enabled
(
$entity_type
)
?
$entity_type
:
FALSE
;
}
$form
[
'entity_types'
][
'#default_value'
]
=
$default
;
$form
[
'#attached'
][
'library'
][]
=
array
(
'translation
_entity
'
,
'drupal.translation
_entity
.admin'
);
$form
[
'#attached'
][
'js'
][]
=
array
(
'data'
=>
drupal_get_path
(
'module'
,
'translation
_entity
'
)
.
'/translation
_entity
.admin.js'
,
'type'
=>
'file'
);
$form
[
'#attached'
][
'library'
][]
=
array
(
'
content_
translation'
,
'drupal.
content_
translation.admin'
);
$form
[
'#attached'
][
'js'
][]
=
array
(
'data'
=>
drupal_get_path
(
'module'
,
'
content_
translation'
)
.
'/
content_
translation.admin.js'
,
'type'
=>
'file'
);
$dependent_options_settings
=
array
();
foreach
(
$form
[
'#labels'
]
as
$entity_type
=>
$label
)
{
...
...
@@ -80,7 +80,7 @@ function _translation_entity_form_language_content_settings_form_alter(array &$f
// Here we do not want the widget to be altered and hold also the "Enable
// translation" checkbox, which would be redundant. Hence we add this key
// to be able to skip alterations.
$form
[
'settings'
][
$entity_type
][
$bundle
][
'settings'
][
'language'
][
'#translation_
entity_
skip_alter'
]
=
TRUE
;
$form
[
'settings'
][
$entity_type
][
$bundle
][
'settings'
][
'language'
][
'#
content_
translation_skip_alter'
]
=
TRUE
;
// Only show the checkbox to enable translation if the bundles in the
// entity might have fields and if there are fields to translate.
...
...
@@ -89,7 +89,7 @@ function _translation_entity_form_language_content_settings_form_alter(array &$f
if
(
$fields
)
{
$form
[
'settings'
][
$entity_type
][
$bundle
][
'translatable'
]
=
array
(
'#type'
=>
'checkbox'
,
'#default_value'
=>
translation_
entity_
enabled
(
$entity_type
,
$bundle
),
'#default_value'
=>
content_
translation_enabled
(
$entity_type
,
$bundle
),
);
// @todo Exploit field definitions once all core entities and field
...
...
@@ -101,7 +101,7 @@ function _translation_entity_form_language_content_settings_form_alter(array &$f
'#type'
=>
'checkbox'
,
'#default_value'
=>
$field
[
'translatable'
],
);
$column_element
=
translation_
entity_
field_sync_widget
(
$field
,
$instance
);
$column_element
=
content_
translation_field_sync_widget
(
$field
,
$instance
);
if
(
$column_element
)
{
$form
[
'settings'
][
$entity_type
][
$bundle
][
'columns'
][
$field_name
]
=
$column_element
;
...
...
@@ -115,18 +115,18 @@ function _translation_entity_form_language_content_settings_form_alter(array &$f
}
}
$settings
=
array
(
'dependent_selectors'
=>
$dependent_options_settings
);
$form
[
'#attached'
][
'js'
][]
=
array
(
'data'
=>
array
(
'
t
ranslation
Entity
DependentOptions'
=>
$settings
),
'type'
=>
'setting'
);
$form
[
'#validate'
][]
=
'translation_
entity_
form_language_content_settings_validate'
;
$form
[
'#submit'
][]
=
'translation_
entity_
form_language_content_settings_submit'
;
$form
[
'#attached'
][
'js'
][]
=
array
(
'data'
=>
array
(
'
contentT
ranslationDependentOptions'
=>
$settings
),
'type'
=>
'setting'
);
$form
[
'#validate'
][]
=
'
content_
translation_form_language_content_settings_validate'
;
$form
[
'#submit'
][]
=
'
content_
translation_form_language_content_settings_submit'
;
}
/**
* (proxied) Implements hook_preprocess_HOOK();
*/
function
_translation_
entity_
preprocess_language_content_settings_table
(
&
$variables
)
{
function
_content
_translation_preprocess_language_content_settings_table
(
&
$variables
)
{
// Alter the 'build' variable injecting the translation settings if the user
// has the required permission.
if
(
!
user_access
(
'administer ent
ity
translation'
))
{
if
(
!
user_access
(
'administer
cont
ent translation'
))
{
return
;
}
...
...
@@ -237,11 +237,11 @@ function _translation_entity_preprocess_language_content_settings_table(&$variab
}
/**
* Form validation handler for translation_
entity_
admin_settings_form().
* Form validation handler for
content_
translation_admin_settings_form().
*
* @see translation_
entity_
admin_settings_form_submit()
* @see
content_
translation_admin_settings_form_submit()
*/
function
translation_
entity_
form_language_content_settings_validate
(
array
$form
,
array
&
$form_state
)
{
function
content_
translation_form_language_content_settings_validate
(
array
$form
,
array
&
$form_state
)
{
$settings
=
&
$form_state
[
'values'
][
'settings'
];
foreach
(
$settings
as
$entity_type
=>
$entity_settings
)
{
foreach
(
$entity_settings
as
$bundle
=>
$bundle_settings
)
{
...
...
@@ -267,11 +267,11 @@ function translation_entity_form_language_content_settings_validate(array $form,
}
/**
* Form submission handler for translation_
entity_
admin_settings_form().
* Form submission handler for
content_
translation_admin_settings_form().
*
* @see translation_
entity_
admin_settings_form_validate()
* @see
content_
translation_admin_settings_form_validate()
*/
function
translation_
entity_
form_language_content_settings_submit
(
array
$form
,
array
&
$form_state
)
{
function
content_
translation_form_language_content_settings_submit
(
array
$form
,
array
&
$form_state
)
{
$entity_types
=
$form_state
[
'values'
][
'entity_types'
];
$settings
=
&
$form_state
[
'values'
][
'settings'
];
...
...
@@ -296,12 +296,12 @@ function translation_entity_form_language_content_settings_submit(array $form, a
}
}
_translation_
entity_
update_field_translatability
(
$settings
);
_content
_translation_update_field_translatability
(
$settings
);
drupal_set_message
(
t
(
'Settings successfully updated.'
));
}
/**
* Stores ent
ity
translation settings.
* Stores
cont
ent translation settings.
*
* @param array $settings
* An associative array of settings keyed by entity type and bundle. At bundle
...
...
@@ -315,7 +315,7 @@ function translation_entity_form_language_content_settings_submit(array $form, a
* @todo Remove this migration entirely once the Field API is converted to the
* Entity Field API.
*/
function
_translation_
entity_
update_field_translatability
(
$settings
)
{
function
_content
_translation_update_field_translatability
(
$settings
)
{
$fields
=
array
();
foreach
(
$settings
as
$entity_type
=>
$entity_settings
)
{
foreach
(
$entity_settings
as
$bundle
=>
$bundle_settings
)
{
...
...
@@ -344,10 +344,10 @@ function _translation_entity_update_field_translatability($settings) {
// data back to Language::LANGCODE_NOT_SPECIFIED before making a field
// untranslatable lest we lose information.
$field_operations
=
array
(
array
(
'translation_
entity_
translatable_switch'
,
array
(
$translatable
,
$field_name
)),
array
(
'
content_
translation_translatable_switch'
,
array
(
$translatable
,
$field_name
)),
);
if
(
$field
->
hasData
())
{
$field_operations
[]
=
array
(
'translation_
entity_
translatable_batch'
,
array
(
$translatable
,
$field_name
));
$field_operations
[]
=
array
(
'
content_
translation_translatable_batch'
,
array
(
$translatable
,
$field_name
));
$field_operations
=
$translatable
?
$field_operations
:
array_reverse
(
$field_operations
);
}
$operations
=
array_merge
(
$operations
,
$field_operations
);
...
...
@@ -355,13 +355,13 @@ function _translation_entity_update_field_translatability($settings) {
}
// As last operation store the submitted settings.
$operations
[]
=
array
(
'translation_
entity_
save_settings'
,
array
(
$settings
));
$operations
[]
=
array
(
'
content_
translation_save_settings'
,
array
(
$settings
));
$batch
=
array
(
'title'
=>
t
(
'Updating translatability for the selected fields'
),
'operations'
=>
$operations
,
'finished'
=>
'translation_
entity_
translatable_batch_done'
,
'file'
=>
drupal_get_path
(
'module'
,
'translation
_entity
'
)
.
'/translation
_entity
.admin.inc'
,
'finished'
=>
'
content_
translation_translatable_batch_done'
,
'file'
=>
drupal_get_path
(
'module'
,
'
content_
translation'
)
.
'/
content_
translation.admin.inc'
,
);
batch_set
(
$batch
);
}
...
...
@@ -369,7 +369,7 @@ function _translation_entity_update_field_translatability($settings) {
/**
* Form constructor for the confirmation of translatability switching.
*/
function
translation_
entity_
translatable_form
(
array
$form
,
array
&
$form_state
,
$field_name
)
{
function
content_
translation_translatable_form
(
array
$form
,
array
&
$form_state
,
$field_name
)
{
$field
=
field_info_field
(
$field_name
);
$t_args
=
array
(
'%name'
=>
$field_name
);
...
...
@@ -396,7 +396,7 @@ function translation_entity_translatable_form(array $form, array &$form_state, $
}
/**
* Form submission handler for translation_
entity_
translatable_form().
* Form submission handler for
content_
translation_translatable_form().
*
* This submit handler maintains consistency between the translatability of an
* entity and the language under which the field data is stored. When a field is
...
...
@@ -407,7 +407,7 @@ function translation_entity_translatable_form(array $form, array &$form_state, $
* untranslatable will cause all of its translations to be permanently removed,
* with the exception of the one corresponding to the entity language.
*/
function
translation_
entity_
translatable_form_submit
(
array
$form
,
array
$form_state
)
{
function
content_
translation_translatable_form_submit
(
array
$form
,
array
$form_state
)
{
// This is the current state that we want to reverse.
$translatable
=
$form_state
[
'values'
][
'translatable'
];
$field_name
=
$form_state
[
'field'
][
'field_name'
];
...
...
@@ -429,8 +429,8 @@ function translation_entity_translatable_form_submit(array $form, array $form_st
// to Language::LANGCODE_NOT_SPECIFIED before making a field untranslatable lest we lose
// information.
$operations
=
array
(
array
(
'translation_
entity_
translatable_batch'
,
array
(
!
$translatable
,
$field_name
)),
array
(
'translation_
entity_
translatable_switch'
,
array
(
!
$translatable
,
$field_name
)),
array
(
'
content_
translation_translatable_batch'
,
array
(
!
$translatable
,
$field_name
)),
array
(
'
content_
translation_translatable_switch'
,
array
(
!
$translatable
,
$field_name
)),
);
$operations
=
$translatable
?
$operations
:
array_reverse
(
$operations
);
...
...
@@ -440,8 +440,8 @@ function translation_entity_translatable_form_submit(array $form, array $form_st
$batch
=
array
(
'title'
=>
$title
,
'operations'
=>
$operations
,
'finished'
=>
'translation_
entity_
translatable_batch_done'
,
'file'
=>
drupal_get_path
(
'module'
,
'translation
_entity
'
)
.
'/translation
_entity
.admin.inc'
,
'finished'
=>
'
content_
translation_translatable_batch_done'
,
'file'
=>
drupal_get_path
(
'module'
,
'
content_
translation'
)
.
'/
content_
translation.admin.inc'
,
);
batch_set
(
$batch
);
...
...
@@ -458,7 +458,7 @@ function translation_entity_translatable_form_submit(array $form, array $form_st
* @param string $field_name
* Field machine name.
*/
function
translation_
entity_
translatable_switch
(
$translatable
,
$field_name
)
{
function
content_
translation_translatable_switch
(
$translatable
,
$field_name
)
{
$field
=
field_info_field
(
$field_name
);
if
(
$field
[
'translatable'
]
!==
$translatable
)
{
$field
[
'translatable'
]
=
$translatable
;
...
...
@@ -475,7 +475,7 @@ function translation_entity_translatable_switch($translatable, $field_name) {
* @param string $field_name
* Field machine name.
*/
function
translation_
entity_
translatable_batch
(
$translatable
,
$field_name
,
&
$context
)
{
function
content_
translation_translatable_batch
(
$translatable
,
$field_name
,
&
$context
)
{
$field
=
field_info_field
(
$field_name
);
$column
=
isset
(
$field
[
'columns'
][
'value'
])
?
'value'
:
key
(
$field
[
'columns'
]);
$query_field
=
"
$field_name
.
$column
"
;
...
...
@@ -554,10 +554,10 @@ function translation_entity_translatable_batch($translatable, $field_name, &$con
// language.
$entity
->
{
$field_name
}[
$langcode
]
=
$entity
->
{
$field_name
}[
Language
::
LANGCODE_NOT_SPECIFIED
];
// Store the original value.
_translation_
entity_
update_field
(
$entity_type
,
$entity
,
$field_name
);
_content
_translation_update_field
(
$entity_type
,
$entity
,
$field_name
);
$entity
->
{
$field_name
}[
Language
::
LANGCODE_NOT_SPECIFIED
]
=
array
();
// Remove the language neutral value.
_translation_
entity_
update_field
(
$entity_type
,
$entity
,
$field_name
);
_content
_translation_update_field
(
$entity_type
,
$entity
,
$field_name
);
}
elseif
(
!
$translatable
&&
isset
(
$entity
->
{
$field_name
}[
$langcode
]))
{
// The field has been marked untranslatable and has data in the entity
...
...
@@ -565,14 +565,14 @@ function translation_entity_translatable_batch($translatable, $field_name, &$con
// other translations.
$entity
->
{
$field_name
}[
Language
::
LANGCODE_NOT_SPECIFIED
]
=
$entity
->
{
$field_name
}[
$langcode
];
// Store the original value.
_translation_
entity_
update_field
(
$entity_type
,
$entity
,
$field_name
);
_content
_translation_update_field
(
$entity_type
,
$entity
,
$field_name
);
// Remove translations.
foreach
(
$entity
->
{
$field_name
}
as
$langcode
=>
$items
)
{
if
(
$langcode
!=
Language
::
LANGCODE_NOT_SPECIFIED
)
{
$entity
->
{
$field_name
}[
$langcode
]
=
array
();
}
}
_translation_
entity_
update_field
(
$entity_type
,
$entity
,
$field_name
);
_content
_translation_update_field
(
$entity_type
,
$entity
,
$field_name
);
}
else
{
// No need to save unchanged entities.
...
...
@@ -587,7 +587,7 @@ function translation_entity_translatable_batch($translatable, $field_name, &$con
/**
* Stores the given field translations.
*/
function
_translation_
entity_
update_field
(
$entity_type
,
EntityInterface
$entity
,
$field_name
)
{
function
_content
_translation_update_field
(
$entity_type
,
EntityInterface
$entity
,
$field_name
)
{
$empty
=
0
;
$translations
=
$entity
->
getTranslationLanguages
();
...
...
@@ -609,7 +609,7 @@ function _translation_entity_update_field($entity_type, EntityInterface $entity,
/**
* Batch finished callback: Checks the exit status of the batch operation.
*/
function
translation_
entity_
translatable_batch_done
(
$success
,
$results
,
$operations
)
{
function
content_
translation_translatable_batch_done
(
$success
,
$results
,
$operations
)
{
if
(
$success
)
{
drupal_set_message
(
t
(
"Successfully changed field translation setting."
));
}
...
...
core/modules/translation
_entity/
translation
_entity
.admin.js
→
core/modules/
content_
translation
/content_
translation.admin.js
View file @
de3558c2
...
...
@@ -5,9 +5,9 @@
/**
* Forces applicable options to be checked as translatable.
*/
Drupal
.
behaviors
.
t
ranslation
Entity
DependentOptions
=
{
Drupal
.
behaviors
.
contentT
ranslationDependentOptions
=
{
attach
:
function
(
context
,
settings
)
{
var
$options
=
settings
.
t
ranslation
Entity
DependentOptions
;
var
$options
=
settings
.
contentT
ranslationDependentOptions
;
var
$collections
=
[];
// We're given a generic name to look for so we find all inputs containing
...
...
@@ -24,11 +24,11 @@ Drupal.behaviors.translationEntityDependentOptions = {
var
$dependent_columns
=
$collection
.
dependent_columns
;
$fields
.
change
(
function
()
{
Drupal
.
behaviors
.
t
ranslation
Entity
DependentOptions
.
check
(
$fields
,
$dependent_columns
,
$
(
this
));