diff --git a/core/lib/Drupal/Core/Entity/Annotation/EntityType.php b/core/lib/Drupal/Core/Entity/Annotation/EntityType.php index beaa4e3..1616ee3 100644 --- a/core/lib/Drupal/Core/Entity/Annotation/EntityType.php +++ b/core/lib/Drupal/Core/Entity/Annotation/EntityType.php @@ -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\EntityTranslationControllerInterface. + * \Drupal\entity_translation\EntityTranslationControllerInterface. * * @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 entity_translation_entity_info_alter() uses this but it is undocumented. * * @var array */ diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockTranslationController.php b/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockTranslationController.php index a8848c7..5132e8b 100644 --- a/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockTranslationController.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockTranslationController.php @@ -8,7 +8,7 @@ namespace Drupal\custom_block; use Drupal\Core\Entity\EntityInterface; -use Drupal\translation_entity\EntityTranslationControllerNG; +use Drupal\entity_translation\EntityTranslationControllerNG; /** * Defines the translation controller class for custom blocks. diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockTypeFormController.php b/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockTypeFormController.php index 6e5de33..eed7cc0 100644 --- a/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockTypeFormController.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockTypeFormController.php @@ -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('entity_translation')) { $form['language'] = array( '#type' => 'details', '#title' => t('Language settings'), diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockTranslationUITest.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockTranslationUITest.php index 3ccac91..3ea0ad9 100644 --- a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockTranslationUITest.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockTranslationUITest.php @@ -7,7 +7,7 @@ namespace Drupal\custom_block\Tests; -use Drupal\translation_entity\Tests\EntityTranslationUITest; +use Drupal\entity_translation\Tests\EntityTranslationUITest; use Drupal\custom_block\Plugin\Core\Entity\CustomBlock; /** @@ -27,7 +27,7 @@ class CustomBlockTranslationUITest extends EntityTranslationUITest { */ public static $modules = array( 'language', - 'translation_entity', + 'entity_translation', 'block', 'field_ui', 'custom_block' @@ -56,7 +56,7 @@ public function setUp() { } /** - * Overrides \Drupal\translation_entity\Tests\EntityTranslationUITest::getTranslatorPermission(). + * Overrides \Drupal\entity_translation\Tests\EntityTranslationUITest::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\EntityTranslationUITest::getNewEntityValues(). + * Overrides \Drupal\entity_translation\Tests\EntityTranslationUITest::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(); + // {entity_translation} table. + $rows = db_query('SELECT * FROM {entity_translation}')->fetchAll(); $this->assertEqual(1, count($rows)); $this->assertEqual($enabled_custom_block->id(), reset($rows)->entity_id); } diff --git a/core/modules/comment/comment.admin.inc b/core/modules/comment/comment.admin.inc index 2bff10b..5c1f9bf 100644 --- a/core/modules/comment/comment.admin.inc +++ b/core/modules/comment/comment.admin.inc @@ -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('entity_translation', 'translate_access', $comment)) { $links['translate'] = array( 'title' => t('translate'), 'href' => 'comment/' . $comment->id() . '/translations', diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index b0f71f1..143aa65 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -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('entity_translation') && entity_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('entity_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['entity_translation']['key'] = 'language_configuration'; + $form['comment'] += entity_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), + 'entity_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('entity_translation' => $form_state['values']['entity_translation'])), ); - translation_entity_language_configuration_element_submit($form, $comment_form_state); + entity_translation_language_configuration_element_submit($form, $comment_form_state); } /** diff --git a/core/modules/comment/comment.views.inc b/core/modules/comment/comment.views.inc index 7783334..31f19b1 100644 --- a/core/modules/comment/comment.views.inc +++ b/core/modules/comment/comment.views.inc @@ -360,12 +360,12 @@ function comment_views_data() { ), ); - if (Drupal::moduleHandler()->moduleExists('translation_entity')) { + if (Drupal::moduleHandler()->moduleExists('entity_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' => 'entity_translation_link', ), ); } diff --git a/core/modules/comment/lib/Drupal/comment/CommentTranslationController.php b/core/modules/comment/lib/Drupal/comment/CommentTranslationController.php index 656af99..0ca9a6e 100644 --- a/core/modules/comment/lib/Drupal/comment/CommentTranslationController.php +++ b/core/modules/comment/lib/Drupal/comment/CommentTranslationController.php @@ -9,7 +9,7 @@ namespace Drupal\comment; use Drupal\Core\Entity\EntityInterface; -use Drupal\translation_entity\EntityTranslationControllerNG; +use Drupal\entity_translation\EntityTranslationControllerNG; /** * Defines the translation controller class for comments. diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentTranslationUITest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentTranslationUITest.php index 2a14791..99866d2 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentTranslationUITest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentTranslationUITest.php @@ -7,7 +7,7 @@ namespace Drupal\comment\Tests; -use Drupal\translation_entity\Tests\EntityTranslationUITest; +use Drupal\entity_translation\Tests\EntityTranslationUITest; /** * Tests the Comment Translation UI. @@ -24,7 +24,7 @@ class CommentTranslationUITest extends EntityTranslationUITest { * * @var array */ - public static $modules = array('language', 'translation_entity', 'node', 'comment'); + public static $modules = array('language', 'entity_translation', 'node', 'comment'); public static function getInfo() { return array( @@ -44,7 +44,7 @@ function setUp() { } /** - * Overrides \Drupal\translation_entity\Tests\EntityTranslationUITest::setupBundle(). + * Overrides \Drupal\entity_translation\Tests\EntityTranslationUITest::setupBundle(). */ function setupBundle() { parent::setupBundle(); @@ -52,14 +52,14 @@ function setupBundle() { } /** - * Overrides \Drupal\translation_entity\Tests\EntityTranslationUITest::getTranslatorPermission(). + * Overrides \Drupal\entity_translation\Tests\EntityTranslationUITest::getTranslatorPermission(). */ protected function getTranslatorPermissions() { return array_merge(parent::getTranslatorPermissions(), array('post comments', 'administer comments')); } /** - * Overrides \Drupal\translation_entity\Tests\EntityTranslationUITest::setupTestFields(). + * Overrides \Drupal\entity_translation\Tests\EntityTranslationUITest::setupTestFields(). */ function setupTestFields() { parent::setupTestFields(); @@ -69,7 +69,7 @@ function setupTestFields() { } /** - * Overrides \Drupal\translation_entity\Tests\EntityTranslationUITest::createEntity(). + * Overrides \Drupal\entity_translation\Tests\EntityTranslationUITest::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\EntityTranslationUITest::getNewEntityValues(). + * Overrides \Drupal\entity_translation\Tests\EntityTranslationUITest::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\EntityTranslationUITest::assertPublishedStatus(). + * Overrides \Drupal\entity_translation\Tests\EntityTranslationUITest::assertPublishedStatus(). */ protected function assertPublishedStatus() { parent::assertPublishedStatus(); diff --git a/core/modules/node/config/views.view.content.yml b/core/modules/node/config/views.view.content.yml index ff4b5ee..96ac2c5 100644 --- a/core/modules/node/config/views.view.content.yml +++ b/core/modules/node/config/views.view.content.yml @@ -230,7 +230,7 @@ display: empty: '' text: Translate optional: '1' - plugin_id: translation_entity_link + plugin_id: entity_translation_link dropbutton: id: dropbutton table: views diff --git a/core/modules/node/lib/Drupal/node/NodeTranslationController.php b/core/modules/node/lib/Drupal/node/NodeTranslationController.php index 4531a8e..757da2d 100644 --- a/core/modules/node/lib/Drupal/node/NodeTranslationController.php +++ b/core/modules/node/lib/Drupal/node/NodeTranslationController.php @@ -8,7 +8,7 @@ namespace Drupal\node; use Drupal\Core\Entity\EntityInterface; -use Drupal\translation_entity\EntityTranslationController; +use Drupal\entity_translation\EntityTranslationController; /** * Defines the translation controller class for nodes. @@ -29,8 +29,8 @@ public function entityFormAlter(array &$form, array &$form_state, EntityInterfac parent::entityFormAlter($form, $form_state, $entity); // Move the translation fieldset to a vertical tab. - if (isset($form['translation_entity'])) { - $form['translation_entity'] += array( + if (isset($form['entity_translation'])) { + $form['entity_translation'] += array( '#group' => 'additional_settings', '#weight' => 100, '#attributes' => array( @@ -40,9 +40,9 @@ public function entityFormAlter(array &$form, array &$form_state, EntityInterfac // We do not need to show these values on node forms: they inherit the // basic node property values. - $form['translation_entity']['status']['#access'] = FALSE; - $form['translation_entity']['name']['#access'] = FALSE; - $form['translation_entity']['created']['#access'] = FALSE; + $form['entity_translation']['status']['#access'] = FALSE; + $form['entity_translation']['name']['#access'] = FALSE; + $form['entity_translation']['created']['#access'] = FALSE; } } @@ -58,9 +58,9 @@ protected function entityFormTitle(EntityInterface $entity) { * Overrides EntityTranslationController::entityFormEntityBuild(). */ public function entityFormEntityBuild($entity_type, EntityInterface $entity, array $form, array &$form_state) { - if (isset($form_state['values']['translation_entity'])) { - $form_controller = translation_entity_form_controller($form_state); - $translation = &$form_state['values']['translation_entity']; + if (isset($form_state['values']['entity_translation'])) { + $form_controller = entity_translation_form_controller($form_state); + $translation = &$form_state['values']['entity_translation']; $translation['status'] = $form_controller->getEntity()->status; $translation['name'] = $form_state['values']['name']; $translation['created'] = $form_state['values']['date']; diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeTranslationUITest.php b/core/modules/node/lib/Drupal/node/Tests/NodeTranslationUITest.php index 9344355..a5a0a76 100644 --- a/core/modules/node/lib/Drupal/node/Tests/NodeTranslationUITest.php +++ b/core/modules/node/lib/Drupal/node/Tests/NodeTranslationUITest.php @@ -8,7 +8,7 @@ namespace Drupal\node\Tests; use Drupal\Core\Entity\EntityInterface; -use Drupal\translation_entity\Tests\EntityTranslationUITest; +use Drupal\entity_translation\Tests\EntityTranslationUITest; /** * Tests the Node Translation UI. @@ -25,7 +25,7 @@ class NodeTranslationUITest extends EntityTranslationUITest { * * @var array */ - public static $modules = array('language', 'translation_entity', 'node', 'datetime', 'field_ui'); + public static $modules = array('language', 'entity_translation', 'node', 'datetime', 'field_ui'); public static function getInfo() { return array( @@ -43,7 +43,7 @@ function setUp() { } /** - * Overrides \Drupal\translation_entity\Tests\EntityTranslationUITest::setupBundle(). + * Overrides \Drupal\entity_translation\Tests\EntityTranslationUITest::setupBundle(). */ protected function setupBundle() { parent::setupBundle(); @@ -51,14 +51,14 @@ protected function setupBundle() { } /** - * Overrides \Drupal\translation_entity\Tests\EntityTranslationUITest::getTranslatorPermission(). + * Overrides \Drupal\entity_translation\Tests\EntityTranslationUITest::getTranslatorPermission(). */ protected function getTranslatorPermissions() { return array_merge(parent::getTranslatorPermissions(), array('administer nodes', "edit any $this->bundle content")); } /** - * Overrides \Drupal\translation_entity\Tests\EntityTranslationUITest::getNewEntityValues(). + * Overrides \Drupal\entity_translation\Tests\EntityTranslationUITest::getNewEntityValues(). */ protected function getNewEntityValues($langcode) { // Node title is not translatable yet, hence we use a fixed value. @@ -66,7 +66,7 @@ protected function getNewEntityValues($langcode) { } /** - * Overrides \Drupal\translation_entity\Tests\EntityTranslationUITest::getFormSubmitAction(). + * Overrides \Drupal\entity_translation\Tests\EntityTranslationUITest::getFormSubmitAction(). */ protected function getFormSubmitAction(EntityInterface $entity) { if ($entity->status) { @@ -76,7 +76,7 @@ protected function getFormSubmitAction(EntityInterface $entity) { } /** - * Overrides \Drupal\translation_entity\Tests\EntityTranslationUITest::assertPublishedStatus(). + * Overrides \Drupal\entity_translation\Tests\EntityTranslationUITest::assertPublishedStatus(). */ protected function assertPublishedStatus() { $entity = entity_load($this->entityType, $this->entityId, TRUE); @@ -108,7 +108,7 @@ protected function assertPublishedStatus() { } /** - * Overrides \Drupal\translation_entity\Tests\EntityTranslationUITest::assertAuthoringInfo(). + * Overrides \Drupal\entity_translation\Tests\EntityTranslationUITest::assertAuthoringInfo(). */ protected function assertAuthoringInfo() { $entity = entity_load($this->entityType, $this->entityId, TRUE); @@ -189,8 +189,8 @@ public function testDisabledBundle() { $disabledNode = $this->drupalCreateNode(array('type' => $disabledBundle)); // Make sure that only a single row was inserted into the - // {translation_entity} table. - $rows = db_query('SELECT * FROM {translation_entity}')->fetchAll(); + // {entity_translation} table. + $rows = db_query('SELECT * FROM {entity_translation}')->fetchAll(); $this->assertEqual(1, count($rows)); $this->assertEqual($enabledNode->id(), reset($rows)->entity_id); } diff --git a/core/modules/node/node.views.inc b/core/modules/node/node.views.inc index b4b34eb..a10959f 100644 --- a/core/modules/node/node.views.inc +++ b/core/modules/node/node.views.inc @@ -217,12 +217,12 @@ function node_views_data() { ); } - if (Drupal::moduleHandler()->moduleExists('translation_entity')) { + if (Drupal::moduleHandler()->moduleExists('entity_translation')) { $data['node']['translation_link'] = array( 'title' => t('Translation link'), 'help' => t('Provide a link to the translations overview for nodes.'), 'field' => array( - 'id' => 'translation_entity_link', + 'id' => 'entity_translation_link', ), ); } diff --git a/core/modules/system/lib/Drupal/system/Tests/Module/DependencyTest.php b/core/modules/system/lib/Drupal/system/Tests/Module/DependencyTest.php index 96955cd..353aacd 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Module/DependencyTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Module/DependencyTest.php @@ -25,11 +25,11 @@ public static function getInfo() { function testEnableWithoutDependency() { // Attempt to enable Entity Translation without Language enabled. $edit = array(); - $edit['modules[Multilingual][translation_entity][enable]'] = 'translation_entity'; + $edit['modules[Multilingual][entity_translation][enable]'] = 'entity_translation'; $this->drupalPost('admin/modules', $edit, t('Save configuration')); $this->assertText(t('Some required modules must be enabled'), 'Dependency required.'); - $this->assertModules(array('translation_entity', 'language'), FALSE); + $this->assertModules(array('entity_translation', 'language'), FALSE); // Assert that the language tables weren't enabled. $this->assertTableCount('language', FALSE); @@ -37,7 +37,7 @@ function testEnableWithoutDependency() { $this->drupalPost(NULL, NULL, t('Continue')); $this->assertText(t('The configuration options have been saved.'), 'Modules status has been updated.'); - $this->assertModules(array('translation_entity', 'language'), TRUE); + $this->assertModules(array('entity_translation', 'language'), TRUE); // Assert that the language tables were enabled. $this->assertTableCount('language', TRUE); diff --git a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Plugin/Core/Entity/EntityTest.php b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Plugin/Core/Entity/EntityTest.php index 25167c7..a14eda0 100644 --- a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Plugin/Core/Entity/EntityTest.php +++ b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Plugin/Core/Entity/EntityTest.php @@ -25,7 +25,7 @@ * "form" = { * "default" = "Drupal\entity_test\EntityTestFormController" * }, - * "translation" = "Drupal\translation_entity\EntityTranslationControllerNG" + * "translation" = "Drupal\entity_translation\EntityTranslationControllerNG" * }, * base_table = "entity_test", * fieldable = TRUE, diff --git a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Plugin/Core/Entity/EntityTestMul.php b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Plugin/Core/Entity/EntityTestMul.php index d39f915..b4516e2 100644 --- a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Plugin/Core/Entity/EntityTestMul.php +++ b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Plugin/Core/Entity/EntityTestMul.php @@ -24,7 +24,7 @@ * "form" = { * "default" = "Drupal\entity_test\EntityTestFormController" * }, - * "translation" = "Drupal\translation_entity\EntityTranslationControllerNG" + * "translation" = "Drupal\entity_translation\EntityTranslationControllerNG" * }, * base_table = "entity_test_mul", * data_table = "entity_test_mul_property_data", diff --git a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Plugin/Core/Entity/EntityTestMulRev.php b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Plugin/Core/Entity/EntityTestMulRev.php index aa5fcd9..590c621 100644 --- a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Plugin/Core/Entity/EntityTestMulRev.php +++ b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Plugin/Core/Entity/EntityTestMulRev.php @@ -24,7 +24,7 @@ * "form" = { * "default" = "Drupal\entity_test\EntityTestFormController" * }, - * "translation" = "Drupal\translation_entity\EntityTranslationControllerNG" + * "translation" = "Drupal\entity_translation\EntityTranslationControllerNG" * }, * base_table = "entity_test_mulrev", * data_table = "entity_test_mulrev_property_data", diff --git a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Plugin/Core/Entity/EntityTestRev.php b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Plugin/Core/Entity/EntityTestRev.php index d3984ea..2e43798 100644 --- a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Plugin/Core/Entity/EntityTestRev.php +++ b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Plugin/Core/Entity/EntityTestRev.php @@ -24,7 +24,7 @@ * "form" = { * "default" = "Drupal\entity_test\EntityTestFormController" * }, - * "translation" = "Drupal\translation_entity\EntityTranslationControllerNG" + * "translation" = "Drupal\entity_translation\EntityTranslationControllerNG" * }, * base_table = "entity_test_rev", * revision_table = "entity_test_rev_revision", diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/TermTranslationController.php b/core/modules/taxonomy/lib/Drupal/taxonomy/TermTranslationController.php index eaf0dbf..176ddf1 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/TermTranslationController.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/TermTranslationController.php @@ -8,7 +8,7 @@ namespace Drupal\taxonomy; use Drupal\Core\Entity\EntityInterface; -use Drupal\translation_entity\EntityTranslationControllerNG; +use Drupal\entity_translation\EntityTranslationControllerNG; /** * Defines the translation controller class for terms. @@ -32,7 +32,7 @@ public function entityFormAlter(array &$form, array &$form_state, EntityInterfac */ function entityFormSave(array $form, array &$form_state) { if ($this->getSourceLangcode($form_state)) { - $entity = translation_entity_form_controller($form_state)->getEntity(); + $entity = entity_translation_form_controller($form_state)->getEntity(); // We need a redirect here, otherwise we would get an access denied page, // since the current URL would be preserved and we would try to add a // translation for a language that already has a translation. diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTranslationUITest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTranslationUITest.php index 15e0ccb..e1355bb 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTranslationUITest.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTranslationUITest.php @@ -8,7 +8,7 @@ namespace Drupal\taxonomy\Tests; use Drupal\Core\Language\Language; -use Drupal\translation_entity\Tests\EntityTranslationUITest; +use Drupal\entity_translation\Tests\EntityTranslationUITest; /** * Tests the Term Translation UI. @@ -32,7 +32,7 @@ class TermTranslationUITest extends EntityTranslationUITest { * * @var array */ - public static $modules = array('language', 'translation_entity', 'taxonomy'); + public static $modules = array('language', 'entity_translation', 'taxonomy'); public static function getInfo() { return array( @@ -50,7 +50,7 @@ function setUp() { } /** - * Overrides \Drupal\translation_entity\Tests\EntityTranslationUITest::setupBundle(). + * Overrides \Drupal\entity_translation\Tests\EntityTranslationUITest::setupBundle(). */ protected function setupBundle() { parent::setupBundle(); @@ -67,14 +67,14 @@ protected function setupBundle() { } /** - * Overrides \Drupal\translation_entity\Tests\EntityTranslationUITest::getTranslatorPermission(). + * Overrides \Drupal\entity_translation\Tests\EntityTranslationUITest::getTranslatorPermission(). */ protected function getTranslatorPermissions() { return array_merge(parent::getTranslatorPermissions(), array('administer taxonomy')); } /** - * Overrides \Drupal\translation_entity\Tests\EntityTranslationUITest::getNewEntityValues(). + * Overrides \Drupal\entity_translation\Tests\EntityTranslationUITest::getNewEntityValues(). */ protected function getNewEntityValues($langcode) { // Term name is not translatable hence we use a fixed value. @@ -82,14 +82,14 @@ protected function getNewEntityValues($langcode) { } /** - * Overrides \Drupal\translation_entity\Tests\EntityTranslationUITest::testTranslationUI(). + * Overrides \Drupal\entity_translation\Tests\EntityTranslationUITest::testTranslationUI(). */ public function testTranslationUI() { parent::testTranslationUI(); // Make sure that no row was inserted for taxonomy vocabularies, which do // not have translations enabled. - $rows = db_query('SELECT * FROM {translation_entity}')->fetchAll(); + $rows = db_query('SELECT * FROM {entity_translation}')->fetchAll(); $this->assertEqual(2, count($rows)); $this->assertEqual('taxonomy_term', $rows[0]->entity_type); $this->assertEqual('taxonomy_term', $rows[1]->entity_type); diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/VocabularyFormController.php b/core/modules/taxonomy/lib/Drupal/taxonomy/VocabularyFormController.php index f6d7f42..7619a26 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/VocabularyFormController.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/VocabularyFormController.php @@ -98,8 +98,8 @@ protected function actions(array $form, array &$form_state) { // We cannot leverage the regular submit handler definition because we // have button-specific ones here. Hence we need to explicitly set it for // the submit action, otherwise it would be ignored. - if (module_exists('translation_entity')) { - array_unshift($actions['submit']['#submit'], 'translation_entity_language_configuration_element_submit'); + if (module_exists('entity_translation')) { + array_unshift($actions['submit']['#submit'], 'entity_translation_language_configuration_element_submit'); } return $actions; } diff --git a/core/modules/taxonomy/taxonomy.admin.inc b/core/modules/taxonomy/taxonomy.admin.inc index 24b71f9..cd2a680 100644 --- a/core/modules/taxonomy/taxonomy.admin.inc +++ b/core/modules/taxonomy/taxonomy.admin.inc @@ -215,7 +215,7 @@ function taxonomy_overview_terms($form, &$form_state, Vocabulary $vocabulary) { 'query' => $destination, ), ); - if (module_invoke('translation_entity', 'translate_access', $term)) { + if (module_invoke('entity_translation', 'translate_access', $term)) { $operations['translate'] = array( 'title' => t('translate'), 'href' => 'taxonomy/term/' . $term->id() . '/translations', diff --git a/core/modules/taxonomy/taxonomy.views.inc b/core/modules/taxonomy/taxonomy.views.inc index 876c6c8..924399c 100644 --- a/core/modules/taxonomy/taxonomy.views.inc +++ b/core/modules/taxonomy/taxonomy.views.inc @@ -177,12 +177,12 @@ function taxonomy_views_data() { ); // Entity translation field. - if (Drupal::moduleHandler()->moduleExists('translation_entity')) { + if (Drupal::moduleHandler()->moduleExists('entity_translation')) { $data['taxonomy_term_data']['translation_link'] = array( 'title' => t('Translation link'), 'help' => t('Provide a link to the translations overview for taxonomy terms.'), 'field' => array( - 'id' => 'translation_entity_link', + 'id' => 'entity_translation_link', ), ); } diff --git a/core/modules/translation_entity/lib/Drupal/translation_entity/EntityTranslationController.php b/core/modules/translation_entity/lib/Drupal/translation_entity/EntityTranslationController.php index 1fb68e5..e309a00 100644 --- a/core/modules/translation_entity/lib/Drupal/translation_entity/EntityTranslationController.php +++ b/core/modules/translation_entity/lib/Drupal/translation_entity/EntityTranslationController.php @@ -2,10 +2,10 @@ /** * @file - * Definition of Drupal\translation_entity\EntityTranslationController. + * Definition of Drupal\entity_translation\EntityTranslationController. */ -namespace Drupal\translation_entity; +namespace Drupal\entity_translation; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Language\Language; @@ -117,14 +117,14 @@ public function getTranslationAccess(EntityInterface $entity, $op) { * Implements EntityTranslationControllerInterface::getSourceLanguage(). */ public function getSourceLangcode(array $form_state) { - return isset($form_state['translation_entity']['source']) ? $form_state['translation_entity']['source']->langcode : FALSE; + return isset($form_state['entity_translation']['source']) ? $form_state['entity_translation']['source']->langcode : FALSE; } /** * Implements EntityTranslationControllerInterface::entityFormAlter(). */ public function entityFormAlter(array &$form, array &$form_state, EntityInterface $entity) { - $form_controller = translation_entity_form_controller($form_state); + $form_controller = entity_translation_form_controller($form_state); $form_langcode = $form_controller->getFormLangcode($form_state); $entity_langcode = $entity->language()->langcode; $source_langcode = $this->getSourceLangcode($form_state); @@ -222,7 +222,7 @@ public function entityFormAlter(array &$form, array &$form_state, EntityInterfac // We need to display the translation tab only when there is at least one // translation available or a new one is about to be created. if ($new_translation || $has_translations) { - $form['translation_entity'] = array( + $form['entity_translation'] = array( '#type' => 'details', '#title' => t('Translation'), '#collapsed' => TRUE, @@ -250,7 +250,7 @@ public function entityFormAlter(array &$form, array &$form_state, EntityInterfac t('An unpublished translation will not be visible without translation permissions.') : t('Only this translation is published. You must publish at least one more translation to unpublish this one.'); - $form['translation_entity']['status'] = array( + $form['entity_translation']['status'] = array( '#type' => 'checkbox', '#title' => t('This translation is published'), '#default_value' => $status, @@ -260,7 +260,7 @@ public function entityFormAlter(array &$form, array &$form_state, EntityInterfac $translate = !$new_translation && $entity->translation[$form_langcode]['outdated']; if (!$translate) { - $form['translation_entity']['retranslate'] = array( + $form['entity_translation']['retranslate'] = array( '#type' => 'checkbox', '#title' => t('Flag other translations as outdated'), '#default_value' => FALSE, @@ -268,7 +268,7 @@ public function entityFormAlter(array &$form, array &$form_state, EntityInterfac ); } else { - $form['translation_entity']['outdated'] = array( + $form['entity_translation']['outdated'] = array( '#type' => 'checkbox', '#title' => t('This translation needs to be updated'), '#default_value' => $translate, @@ -277,7 +277,7 @@ public function entityFormAlter(array &$form, array &$form_state, EntityInterfac } $name = $new_translation ? $GLOBALS['user']->name : user_load($entity->translation[$form_langcode]['uid'])->name; - $form['translation_entity']['name'] = array( + $form['entity_translation']['name'] = array( '#type' => 'textfield', '#title' => t('Authored by'), '#maxlength' => 60, @@ -287,7 +287,7 @@ public function entityFormAlter(array &$form, array &$form_state, EntityInterfac ); $date = $new_translation ? REQUEST_TIME : $entity->translation[$form_langcode]['created']; - $form['translation_entity']['created'] = array( + $form['entity_translation']['created'] = array( '#type' => 'textfield', '#title' => t('Authored on'), '#maxlength' => 25, @@ -319,7 +319,7 @@ public function entityFormAlter(array &$form, array &$form_state, EntityInterfac /** * Process callback: determines which elements get clue in the form. * - * @see \Drupal\translation_entity\EntityTranslationController::entityFormAlter() + * @see \Drupal\entity_translation\EntityTranslationController::entityFormAlter() */ public function entityFormSharedElements($element, $form_state, $form) { static $ignored_types; @@ -344,7 +344,7 @@ public function entityFormSharedElements($element, $form_state, $form) { // If we are displaying a multilingual entity form we need to provide // translatability clues, otherwise the shared form elements should be // hidden. - if (empty($form_state['translation_entity']['translation_form'])) { + if (empty($form_state['entity_translation']['translation_form'])) { $this->addTranslatabilityClue($element[$key]); } else { @@ -403,16 +403,16 @@ protected function addTranslatabilityClue(&$element) { * @param \Drupal\Core\Entity\EntityInterface $entity * The entity whose form is being built. * - * @see \Drupal\translation_entity\EntityTranslationController::entityFormAlter() + * @see \Drupal\entity_translation\EntityTranslationController::entityFormAlter() */ public function entityFormEntityBuild($entity_type, EntityInterface $entity, array $form, array &$form_state) { - $form_controller = translation_entity_form_controller($form_state); + $form_controller = entity_translation_form_controller($form_state); $form_langcode = $form_controller->getFormLangcode($form_state); if (!isset($entity->translation[$form_langcode])) { $entity->translation[$form_langcode] = array(); } - $values = isset($form_state['values']['translation_entity']) ? $form_state['values']['translation_entity'] : array(); + $values = isset($form_state['values']['entity_translation']) ? $form_state['values']['entity_translation'] : array(); $translation = &$entity->translation[$form_langcode]; // @todo Use the entity setter when all entities support multilingual @@ -446,15 +446,15 @@ public function entityFormEntityBuild($entity_type, EntityInterface $entity, arr * Validates the submitted entity translation metadata. */ function entityFormValidate($form, &$form_state) { - if (!empty($form_state['values']['translation_entity'])) { - $translation = $form_state['values']['translation_entity']; + if (!empty($form_state['values']['entity_translation'])) { + $translation = $form_state['values']['entity_translation']; // Validate the "authored by" field. if (!empty($translation['name']) && !($account = user_load_by_name($translation['name']))) { - form_set_error('translation_entity][name', t('The translation authoring username %name does not exist.', array('%name' => $translation['name']))); + form_set_error('entity_translation][name', t('The translation authoring username %name does not exist.', array('%name' => $translation['name']))); } // Validate the "authored on" field. if (!empty($translation['created']) && strtotime($translation['created']) === FALSE) { - form_set_error('translation_entity][created', t('You have to specify a valid translation authoring date.')); + form_set_error('entity_translation][created', t('You have to specify a valid translation authoring date.')); } } } @@ -465,7 +465,7 @@ function entityFormValidate($form, &$form_state) { * Takes care of the source language change. */ public function entityFormSourceChange($form, &$form_state) { - $form_controller = translation_entity_form_controller($form_state); + $form_controller = entity_translation_form_controller($form_state); $entity = $form_controller->getEntity(); $source = $form_state['values']['source_langcode']['source']; $path = $this->getBasePath($entity) . '/translations/add/' . $source . '/' . $form_controller->getFormLangcode($form_state); @@ -480,7 +480,7 @@ public function entityFormSourceChange($form, &$form_state) { * Takes care of entity deletion. */ function entityFormDelete($form, &$form_state) { - $form_controller = translation_entity_form_controller($form_state); + $form_controller = entity_translation_form_controller($form_state); $entity = $form_controller->getEntity(); if (count($entity->getTranslationLanguages()) > 1) { drupal_set_message(t('This will delete all the translations of %label.', array('%label' => $entity->label())), 'warning'); @@ -493,7 +493,7 @@ function entityFormDelete($form, &$form_state) { * Takes care of entity translation deletion. */ function entityFormDeleteTranslation($form, &$form_state) { - $form_controller = translation_entity_form_controller($form_state); + $form_controller = entity_translation_form_controller($form_state); $entity = $form_controller->getEntity(); $base_path = $this->getBasePath($entity); $form_langcode = $form_controller->getFormLangcode($form_state); diff --git a/core/modules/translation_entity/lib/Drupal/translation_entity/EntityTranslationControllerInterface.php b/core/modules/translation_entity/lib/Drupal/translation_entity/EntityTranslationControllerInterface.php index dbac33b..159fba2 100644 --- a/core/modules/translation_entity/lib/Drupal/translation_entity/EntityTranslationControllerInterface.php +++ b/core/modules/translation_entity/lib/Drupal/translation_entity/EntityTranslationControllerInterface.php @@ -2,10 +2,10 @@ /** * @file - * Definition of Drupal\translation_entity\EntityTranslationControllerInterface. + * Definition of Drupal\entity_translation\EntityTranslationControllerInterface. */ -namespace Drupal\translation_entity; +namespace Drupal\entity_translation; use Drupal\Core\Entity\EntityInterface; @@ -38,9 +38,9 @@ * Every entity type needs a translation controller to be translated. This can * be specified through the "controllers['translation']" key in the entity * info. If an entity type is enabled for translation and no translation - * controller is defined, Drupal\translation_entity\EntityTranslationController + * controller is defined, Drupal\entity_translation\EntityTranslationController * will be assumed. Every translation controller class must implement - * Drupal\translation_entity\EntityTranslationControllerInterface. + * Drupal\entity_translation\EntityTranslationControllerInterface. * * If the entity paths match the default patterns above and there is no need for * an entity-specific translation controller class, Entity Translation will @@ -50,7 +50,7 @@ * Additionally some more entity info keys can be defined to further customize * the translation UI. The entity translation info is an associative array that * has to match the following structure. Two nested arrays keyed respectively - * by the 'translation' key and the 'translation_entity' key. Elements: + * by the 'translation' key and the 'entity_translation' key. Elements: * - access callback: The access callback for the translation pages. Defaults to * 'entity_translation_translate_access'. * - access arguments: The access arguments for the translation pages. By @@ -64,7 +64,7 @@ * 'menu_base_path' => 'mymodule/myentity/%my_entity_loader', * 'menu_path_wildcard' => '%my_entity_loader', * 'translation' => array( - * 'translation_entity' => array( + * 'entity_translation' => array( * 'access_callback' => 'mymodule_myentity_translate_access', * 'access_arguments' => array(2), * ), diff --git a/core/modules/translation_entity/lib/Drupal/translation_entity/EntityTranslationControllerNG.php b/core/modules/translation_entity/lib/Drupal/translation_entity/EntityTranslationControllerNG.php index fd007cd..1efa556 100644 --- a/core/modules/translation_entity/lib/Drupal/translation_entity/EntityTranslationControllerNG.php +++ b/core/modules/translation_entity/lib/Drupal/translation_entity/EntityTranslationControllerNG.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\translation_entity\EntityTranslationControllerNG. + * Contains \Drupal\entity_translation\EntityTranslationControllerNG. */ -namespace Drupal\translation_entity; +namespace Drupal\entity_translation; use Drupal\Core\Entity\EntityInterface; @@ -15,14 +15,14 @@ class EntityTranslationControllerNG extends EntityTranslationController { /** - * Overrides \Drupal\translation_entity\EntityTranslationController::getAccess(). + * Overrides \Drupal\entity_translation\EntityTranslationController::getAccess(). */ public function getAccess(EntityInterface $entity, $op) { return $entity->access($op); } /** - * Overrides \Drupal\translation_entity\EntityTranslationControllerInterface::removeTranslation(). + * Overrides \Drupal\entity_translation\EntityTranslationControllerInterface::removeTranslation(). */ public function removeTranslation(EntityInterface $entity, $langcode) { $translation = $entity->getTranslation($langcode); diff --git a/core/modules/translation_entity/lib/Drupal/translation_entity/FieldTranslationSynchronizer.php b/core/modules/translation_entity/lib/Drupal/translation_entity/FieldTranslationSynchronizer.php index 39d1a21..763e266 100644 --- a/core/modules/translation_entity/lib/Drupal/translation_entity/FieldTranslationSynchronizer.php +++ b/core/modules/translation_entity/lib/Drupal/translation_entity/FieldTranslationSynchronizer.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\translation_entity\FieldTranslationSynchronizer. + * Contains \Drupal\entity_translation\FieldTranslationSynchronizer. */ -namespace Drupal\translation_entity; +namespace Drupal\entity_translation; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityManager; diff --git a/core/modules/translation_entity/lib/Drupal/translation_entity/FieldTranslationSynchronizerInterface.php b/core/modules/translation_entity/lib/Drupal/translation_entity/FieldTranslationSynchronizerInterface.php index 1ae361c..bf48e52 100644 --- a/core/modules/translation_entity/lib/Drupal/translation_entity/FieldTranslationSynchronizerInterface.php +++ b/core/modules/translation_entity/lib/Drupal/translation_entity/FieldTranslationSynchronizerInterface.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\translation_entity\FieldTranslationSynchronizerInterface. + * Contains \Drupal\entity_translation\FieldTranslationSynchronizerInterface. */ -namespace Drupal\translation_entity; +namespace Drupal\entity_translation; use Drupal\Core\Entity\EntityInterface; diff --git a/core/modules/translation_entity/lib/Drupal/translation_entity/Plugin/views/field/TranslationLink.php b/core/modules/translation_entity/lib/Drupal/translation_entity/Plugin/views/field/TranslationLink.php index 6c0dcab..afa9b35 100644 --- a/core/modules/translation_entity/lib/Drupal/translation_entity/Plugin/views/field/TranslationLink.php +++ b/core/modules/translation_entity/lib/Drupal/translation_entity/Plugin/views/field/TranslationLink.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\translation_entity\Plugin\views\field\TranslationLink. + * Contains \Drupal\entity_translation\Plugin\views\field\TranslationLink. */ -namespace Drupal\translation_entity\Plugin\views\field; +namespace Drupal\entity_translation\Plugin\views\field; use Drupal\views\Plugin\views\field\FieldPluginBase; use Drupal\Component\Annotation\PluginID; @@ -16,7 +16,7 @@ * * @ingroup views_field_handlers * - * @PluginID("translation_entity_link") + * @PluginID("entity_translation_link") */ class TranslationLink extends FieldPluginBase { @@ -60,7 +60,7 @@ function render($values) { * The acutal rendered text (without the link) of this field. */ public function render_link(EntityInterface $entity, \stdClass $values) { - if (translation_entity_translate_access($entity)) { + if (entity_translation_translate_access($entity)) { $text = !empty($this->options['text']) ? $this->options['text'] : t('translate'); $this->options['alter']['make_link'] = TRUE; diff --git a/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/ConfigTestTranslationUITest.php b/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/ConfigTestTranslationUITest.php index 9c51c46..62cfec0 100644 --- a/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/ConfigTestTranslationUITest.php +++ b/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/ConfigTestTranslationUITest.php @@ -5,7 +5,7 @@ * Definition of Drupal\entity\Tests\ConfigTestTranslationUITest. */ -namespace Drupal\translation_entity\Tests; +namespace Drupal\entity_translation\Tests; /** * Tests the Config Test Translation UI. @@ -19,7 +19,7 @@ class ConfigTestTranslationUITest extends EntityTranslationUITest { * * @var array */ - public static $modules = array('language', 'translation_entity', 'image', 'config_test'); + public static $modules = array('language', 'entity_translation', 'image', 'config_test'); public static function getInfo() { return array( @@ -35,7 +35,7 @@ function setUp() { } /** - * Overrides \Drupal\translation_entity\Tests\EntityTranslationUITest::enableTranslation(). + * Overrides \Drupal\entity_translation\Tests\EntityTranslationUITest::enableTranslation(). */ protected function enableTranslation() { $this->container->get('state')->set('config_test.translatable', TRUE); @@ -43,7 +43,7 @@ protected function enableTranslation() { } /** - * Overrides \Drupal\translation_entity\Tests\EntityTranslationUITest::getNewEntityValues(). + * Overrides \Drupal\entity_translation\Tests\EntityTranslationUITest::getNewEntityValues(). */ protected function getNewEntityValues($langcode) { return array( diff --git a/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTestTranslationUITest.php b/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTestTranslationUITest.php index 3a34da1..f5fa653 100644 --- a/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTestTranslationUITest.php +++ b/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTestTranslationUITest.php @@ -5,7 +5,7 @@ * Definition of Drupal\entity\Tests\EntityTestTranslationUITest. */ -namespace Drupal\translation_entity\Tests; +namespace Drupal\entity_translation\Tests; /** * Tests the Entity Test Translation UI. @@ -17,7 +17,7 @@ class EntityTestTranslationUITest extends EntityTranslationUITest { * * @var array */ - public static $modules = array('language', 'translation_entity', 'entity_test'); + public static $modules = array('language', 'entity_translation', 'entity_test'); public static function getInfo() { return array( @@ -37,14 +37,14 @@ function setUp() { } /** - * Overrides \Drupal\translation_entity\Tests\EntityTranslationUITest::getTranslatorPermission(). + * Overrides \Drupal\entity_translation\Tests\EntityTranslationUITest::getTranslatorPermission(). */ protected function getTranslatorPermissions() { return array_merge(parent::getTranslatorPermissions(), array('administer entity_test content')); } /** - * Overrides \Drupal\translation_entity\Tests\EntityTranslationUITest::getNewEntityValues(). + * Overrides \Drupal\entity_translation\Tests\EntityTranslationUITest::getNewEntityValues(). */ protected function getNewEntityValues($langcode) { return array( diff --git a/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationSettingsTest.php b/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationSettingsTest.php index cb90b6d..1a29dec 100644 --- a/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationSettingsTest.php +++ b/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationSettingsTest.php @@ -2,10 +2,10 @@ /** * @file - * Contains Drupal\translation_entity\Tests\EntityTranslationSettingsTest. + * Contains Drupal\entity_translation\Tests\EntityTranslationSettingsTest. */ -namespace Drupal\translation_entity\Tests; +namespace Drupal\entity_translation\Tests; use Drupal\Core\Language\Language; use Drupal\simpletest\WebTestBase; @@ -20,7 +20,7 @@ class EntityTranslationSettingsTest extends WebTestBase { * * @var array */ - public static $modules = array('language', 'translation_entity', 'comment'); + public static $modules = array('language', 'entity_translation', 'comment'); public static function getInfo() { return array( @@ -118,7 +118,7 @@ protected function assertSettings($entity_type, $bundle, $enabled, $edit) { $args = array('@entity_type' => $entity_type, '@bundle' => $bundle, '@enabled' => $enabled ? 'enabled' : 'disabled'); $message = format_string('Translation for entity @entity_type (@bundle) is @enabled.', $args); entity_info_cache_clear(); - return $this->assertEqual(translation_entity_enabled($entity_type, $bundle), $enabled, $message); + return $this->assertEqual(entity_translation_enabled($entity_type, $bundle), $enabled, $message); } } diff --git a/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationSyncImageTest.php b/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationSyncImageTest.php index 6e9b82e..9401267 100644 --- a/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationSyncImageTest.php +++ b/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationSyncImageTest.php @@ -5,7 +5,7 @@ * Contains \Drupal\entity\Tests\EntityTranslationSyncImageTest. */ -namespace Drupal\translation_entity\Tests; +namespace Drupal\entity_translation\Tests; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Language\Language; @@ -34,7 +34,7 @@ class EntityTranslationSyncImageTest extends EntityTranslationTestBase { * * @var array */ - public static $modules = array('language', 'translation_entity', 'entity_test', 'image'); + public static $modules = array('language', 'entity_translation', 'entity_test', 'image'); public static function getInfo() { return array( diff --git a/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationSyncUnitTest.php b/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationSyncUnitTest.php index 3a77d95..9a1257e 100644 --- a/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationSyncUnitTest.php +++ b/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationSyncUnitTest.php @@ -5,11 +5,11 @@ * Contains \Drupal\entity\Tests\EntityTranslationSyncUnitTest. */ -namespace Drupal\translation_entity\Tests; +namespace Drupal\entity_translation\Tests; use Drupal\Core\Language\Language; use Drupal\simpletest\DrupalUnitTestBase; -use Drupal\translation_entity\FieldTranslationSynchronizer; +use Drupal\entity_translation\FieldTranslationSynchronizer; /** * Tests the Entity Translation field synchronization algorithm. @@ -19,7 +19,7 @@ class EntityTranslationSyncUnitTest extends DrupalUnitTestBase { /** * The synchronizer class to be tested. * - * @var \Drupal\translation_entity\FieldTranslationSynchronizer + * @var \Drupal\entity_translation\FieldTranslationSynchronizer */ protected $synchronizer; @@ -58,7 +58,7 @@ class EntityTranslationSyncUnitTest extends DrupalUnitTestBase { */ protected $unchangedFieldValues; - public static $modules = array('language', 'translation_entity'); + public static $modules = array('language', 'entity_translation'); public static function getInfo() { return array( diff --git a/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationTestBase.php b/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationTestBase.php index 4b99445..62bdf25 100644 --- a/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationTestBase.php +++ b/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationTestBase.php @@ -5,7 +5,7 @@ * Contains \Drupal\entity\Tests\EntityTranslationTestBase. */ -namespace Drupal\translation_entity\Tests; +namespace Drupal\entity_translation\Tests; use Drupal\Core\Entity\DatabaseStorageControllerNG; use Drupal\Core\Language\Language; @@ -68,7 +68,7 @@ /** * The translation controller for the current entity type. * - * @var \Drupal\translation_entity\EntityTranslationControllerInterface + * @var \Drupal\entity_translation\EntityTranslationControllerInterface */ protected $controller; @@ -81,7 +81,7 @@ function setUp() { $this->setupUsers(); $this->setupTestFields(); - $this->controller = translation_entity_controller($this->entityType); + $this->controller = entity_translation_controller($this->entityType); // Rebuild the container so that the new languages are picked up by services // that hold a list of languages. @@ -149,7 +149,7 @@ protected function setupBundle() { protected function enableTranslation() { // Enable translation for the current entity type and ensure the change is // picked up. - translation_entity_set_config($this->entityType, $this->bundle, 'enabled', TRUE); + entity_translation_set_config($this->entityType, $this->bundle, 'enabled', TRUE); drupal_static_reset(); entity_info_cache_clear(); menu_router_rebuild(); diff --git a/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationUITest.php b/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationUITest.php index 50e8bbd..b92fdf9 100644 --- a/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationUITest.php +++ b/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationUITest.php @@ -5,7 +5,7 @@ * Definition of Drupal\entity\Tests\EntityTranslationUITest. */ -namespace Drupal\translation_entity\Tests; +namespace Drupal\entity_translation\Tests; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityNG; @@ -83,7 +83,7 @@ protected function assertBasicTranslation() { // Add another translation and mark the other ones as outdated. $values[$langcode] = $this->getNewEntityValues($langcode); - $edit = $this->getEditValues($values, $langcode) + array('translation_entity[retranslate]' => TRUE); + $edit = $this->getEditValues($values, $langcode) + array('entity_translation[retranslate]' => TRUE); $this->drupalPost($path, $edit, $this->getFormSubmitAction($entity)); $entity = entity_load($this->entityType, $this->entityId, TRUE); @@ -108,7 +108,7 @@ protected function assertOutdatedStatus() { $default_langcode = $this->langcodes[0]; // Mark translations as outdated. - $edit = array('translation_entity[retranslate]' => TRUE); + $edit = array('entity_translation[retranslate]' => TRUE); $this->drupalPost($langcode . '/' . $this->controller->getEditPath($entity), $edit, $this->getFormSubmitAction($entity)); $entity = entity_load($this->entityType, $this->entityId, TRUE); @@ -118,14 +118,14 @@ protected function assertOutdatedStatus() { $path = $prefix . $this->controller->getEditPath($entity); $this->drupalGet($path); if ($enabled_langcode == $langcode) { - $this->assertFieldByXPath('//input[@name="translation_entity[retranslate]"]', FALSE, 'The retranslate flag is not checked by default.'); + $this->assertFieldByXPath('//input[@name="entity_translation[retranslate]"]', FALSE, 'The retranslate flag is not checked by default.'); } else { - $this->assertFieldByXPath('//input[@name="translation_entity[outdated]"]', TRUE, 'The translate flag is checked by default.'); - $edit = array('translation_entity[outdated]' => FALSE); + $this->assertFieldByXPath('//input[@name="entity_translation[outdated]"]', TRUE, 'The translate flag is checked by default.'); + $edit = array('entity_translation[outdated]' => FALSE); $this->drupalPost($path, $edit, $this->getFormSubmitAction($entity)); $this->drupalGet($path); - $this->assertFieldByXPath('//input[@name="translation_entity[retranslate]"]', FALSE, 'The retranslate flag is now shown.'); + $this->assertFieldByXPath('//input[@name="entity_translation[retranslate]"]', FALSE, 'The retranslate flag is now shown.'); $entity = entity_load($this->entityType, $this->entityId, TRUE); $this->assertFalse($entity->translation[$enabled_langcode]['outdated'], 'The "outdated" status has been correctly stored.'); } @@ -142,7 +142,7 @@ protected function assertPublishedStatus() { // Unpublish translations. foreach ($this->langcodes as $index => $langcode) { if ($index > 0) { - $edit = array('translation_entity[status]' => FALSE); + $edit = array('entity_translation[status]' => FALSE); $this->drupalPost($langcode . '/' . $path, $edit, $this->getFormSubmitAction($entity)); $entity = entity_load($this->entityType, $this->entityId, TRUE); $this->assertFalse($entity->translation[$langcode]['status'], 'The translation has been correctly unpublished.'); @@ -151,7 +151,7 @@ protected function assertPublishedStatus() { // Check that the last published translation cannot be unpublished. $this->drupalGet($path); - $this->assertFieldByXPath('//input[@name="translation_entity[status]" and @disabled="disabled"]', TRUE, 'The last translation is published and cannot be unpublished.'); + $this->assertFieldByXPath('//input[@name="entity_translation[status]" and @disabled="disabled"]', TRUE, 'The last translation is published and cannot be unpublished.'); } /** @@ -170,8 +170,8 @@ protected function assertAuthoringInfo() { 'created' => REQUEST_TIME - mt_rand(0, 1000), ); $edit = array( - 'translation_entity[name]' => $user->name, - 'translation_entity[created]' => format_date($values[$langcode]['created'], 'custom', 'Y-m-d H:i:s O'), + 'entity_translation[name]' => $user->name, + 'entity_translation[created]' => format_date($values[$langcode]['created'], 'custom', 'Y-m-d H:i:s O'), ); $prefix = $index > 0 ? $langcode . '/' : ''; $this->drupalPost($prefix . $path, $edit, $this->getFormSubmitAction($entity)); @@ -187,8 +187,8 @@ protected function assertAuthoringInfo() { $langcode = 'en'; $edit = array( // User names have by default length 8. - 'translation_entity[name]' => $this->randomName(12), - 'translation_entity[created]' => '19/11/1978', + 'entity_translation[name]' => $this->randomName(12), + 'entity_translation[created]' => '19/11/1978', ); $this->drupalPost($path, $edit, $this->getFormSubmitAction($entity)); $this->assertTrue($this->xpath('//div[@id="messages"]//div[contains(@class, "error")]//ul'), 'Invalid values generate a list of form errors.'); diff --git a/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationWorkflowsTest.php b/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationWorkflowsTest.php index 9475ab0..b9f63a6 100644 --- a/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationWorkflowsTest.php +++ b/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationWorkflowsTest.php @@ -5,7 +5,7 @@ * Contains \Drupal\entity\Tests\EntityTranslationWorkflowsTest. */ -namespace Drupal\translation_entity\Tests; +namespace Drupal\entity_translation\Tests; use Drupal\Core\Language\Language; use Drupal\user\UserInterface; @@ -27,7 +27,7 @@ class EntityTranslationWorkflowsTest extends EntityTranslationTestBase { * * @var array */ - public static $modules = array('language', 'translation_entity', 'entity_test'); + public static $modules = array('language', 'entity_translation', 'entity_test'); public static function getInfo() { return array( @@ -43,7 +43,7 @@ function setUp() { } /** - * Overrides \Drupal\translation_entity\Tests\EntityTranslationTestBase::getEditorPermissions(). + * Overrides \Drupal\entity_translation\Tests\EntityTranslationTestBase::getEditorPermissions(). */ protected function getEditorPermissions() { return array('administer entity_test content'); diff --git a/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/Views/TranslationEntityViewsUITest.php b/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/Views/TranslationEntityViewsUITest.php index ab1f4ef..887a27b 100644 --- a/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/Views/TranslationEntityViewsUITest.php +++ b/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/Views/TranslationEntityViewsUITest.php @@ -2,15 +2,15 @@ /** * @file - * Contains \Drupal\translation_entity\Tests\Views\TranslationEntityViewsUITest. + * Contains \Drupal\entity_translation\Tests\Views\TranslationEntityViewsUITest. */ -namespace Drupal\translation_entity\Tests\Views; +namespace Drupal\entity_translation\Tests\Views; use Drupal\views_ui\Tests\UITestBase; /** - * Tests the views UI when translation_entity is enabled. + * Tests the views UI when entity_translation is enabled. */ class TranslationEntityViewsUITest extends UITestBase { @@ -26,7 +26,7 @@ class TranslationEntityViewsUITest extends UITestBase { * * @var array */ - public static $modules = array('translation_entity'); + public static $modules = array('entity_translation'); public static function getInfo() { return array( diff --git a/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/Views/TranslationLinkTest.php b/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/Views/TranslationLinkTest.php index 7c9788e..f5d088f 100644 --- a/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/Views/TranslationLinkTest.php +++ b/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/Views/TranslationLinkTest.php @@ -2,19 +2,19 @@ /** * @file - * Contains \Drupal\translation_entity\Tests\Views\TranslationLinkTest. + * Contains \Drupal\entity_translation\Tests\Views\TranslationLinkTest. */ -namespace Drupal\translation_entity\Tests\Views; +namespace Drupal\entity_translation\Tests\Views; use Drupal\views\Tests\ViewTestBase; -use Drupal\translation_entity\Tests\EntityTranslationTestBase; +use Drupal\entity_translation\Tests\EntityTranslationTestBase; use Drupal\views\Tests\ViewTestData; /** * Tests the Entity translation overview link field handler. * - * @see \Drupal\translation_entity\Plugin\views\field\TranslationLink + * @see \Drupal\entity_translation\Plugin\views\field\TranslationLink */ class TranslationLinkTest extends EntityTranslationTestBase { @@ -30,7 +30,7 @@ class TranslationLinkTest extends EntityTranslationTestBase { * * @var array */ - public static $modules = array('translation_entity_test_views'); + public static $modules = array('entity_translation_test_views'); public static function getInfo() { return array( @@ -46,7 +46,7 @@ function setUp() { parent::setUp(); - ViewTestData::importTestViews(get_class($this), array('translation_entity_test_views')); + ViewTestData::importTestViews(get_class($this), array('entity_translation_test_views')); } /** @@ -55,7 +55,7 @@ function setUp() { public function testTranslationLink() { $this->drupalGet('test-entity-translations-link'); $this->assertLinkByHref('user/1/translations'); - $this->assertNoLinkByHref('user/2/translations', 'The translations link is not present when translation_entity_translate_access() is FALSE.'); + $this->assertNoLinkByHref('user/2/translations', 'The translations link is not present when entity_translation_translate_access() is FALSE.'); } } diff --git a/core/modules/translation_entity/tests/modules/translation_entity_test_views/test_views/views.view.test_entity_translations_link.yml b/core/modules/translation_entity/tests/modules/translation_entity_test_views/test_views/views.view.test_entity_translations_link.yml index 30f98a3..ef7b637 100644 --- a/core/modules/translation_entity/tests/modules/translation_entity_test_views/test_views/views.view.test_entity_translations_link.yml +++ b/core/modules/translation_entity/tests/modules/translation_entity_test_views/test_views/views.view.test_entity_translations_link.yml @@ -59,7 +59,7 @@ display: empty_zero: '0' hide_alter_empty: '1' text: Translate - plugin_id: translation_entity_link + plugin_id: entity_translation_link filters: uid_raw: id: uid_raw diff --git a/core/modules/translation_entity/tests/modules/translation_entity_test_views/translation_entity_test_views.info.yml b/core/modules/translation_entity/tests/modules/translation_entity_test_views/translation_entity_test_views.info.yml index 623f484..2a39d29 100644 --- a/core/modules/translation_entity/tests/modules/translation_entity_test_views/translation_entity_test_views.info.yml +++ b/core/modules/translation_entity/tests/modules/translation_entity_test_views/translation_entity_test_views.info.yml @@ -5,6 +5,6 @@ package: Testing version: VERSION core: 8.x dependencies: - - translation_entity + - entity_translation - views hidden: true diff --git a/core/modules/translation_entity/translation_entity.admin.inc b/core/modules/translation_entity/translation_entity.admin.inc index 01e9368..90273dc 100644 --- a/core/modules/translation_entity/translation_entity.admin.inc +++ b/core/modules/translation_entity/translation_entity.admin.inc @@ -21,7 +21,7 @@ * @return array * A form element to configure field synchronization. */ -function translation_entity_field_sync_widget(Field $field, FieldInstance $instance) { +function entity_translation_field_sync_widget(Field $field, FieldInstance $instance) { $element = array(); if (!empty($field['settings']['column_groups']) && count($field['settings']['column_groups']) > 1) { @@ -42,7 +42,7 @@ 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('entity_translation', 'drupal.entity_translation.admin'), ), 'js' => array( array('data' => array('translationEntityDependentOptions' => $settings), 'type' => 'setting'), @@ -57,7 +57,7 @@ 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 _entity_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 entity translation')) { @@ -66,12 +66,12 @@ function _translation_entity_form_language_content_settings_form_alter(array &$f $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 || entity_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('entity_translation', 'drupal.entity_translation.admin'); + $form['#attached']['js'][] = array('data' => drupal_get_path('module', 'entity_translation') . '/entity_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']['#entity_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' => entity_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 = entity_translation_field_sync_widget($field, $instance); if ($column_element) { $form['settings'][$entity_type][$bundle]['columns'][$field_name] = $column_element; @@ -116,14 +116,14 @@ function _translation_entity_form_language_content_settings_form_alter(array &$f } $settings = array('dependent_selectors' => $dependent_options_settings); $form['#attached']['js'][] = array('data' => array('translationEntityDependentOptions' => $settings), 'type' => 'setting'); - $form['#validate'][] = 'translation_entity_form_language_content_settings_validate'; - $form['#submit'][] = 'translation_entity_form_language_content_settings_submit'; + $form['#validate'][] = 'entity_translation_form_language_content_settings_validate'; + $form['#submit'][] = 'entity_translation_form_language_content_settings_submit'; } /** * (proxied) Implements hook_preprocess_HOOK(); */ -function _translation_entity_preprocess_language_content_settings_table(&$variables) { +function _entity_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 entity translation')) { @@ -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 entity_translation_admin_settings_form(). * - * @see translation_entity_admin_settings_form_submit() + * @see entity_translation_admin_settings_form_submit() */ -function translation_entity_form_language_content_settings_validate(array $form, array &$form_state) { +function entity_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 entity_translation_admin_settings_form(). * - * @see translation_entity_admin_settings_form_validate() + * @see entity_translation_admin_settings_form_validate() */ -function translation_entity_form_language_content_settings_submit(array $form, array &$form_state) { +function entity_translation_form_language_content_settings_submit(array $form, array &$form_state) { $entity_types = $form_state['values']['entity_types']; $settings = &$form_state['values']['settings']; @@ -296,7 +296,7 @@ function translation_entity_form_language_content_settings_submit(array $form, a } } - _translation_entity_update_field_translatability($settings); + _entity_translation_update_field_translatability($settings); drupal_set_message(t('Settings successfully updated.')); } @@ -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 _entity_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('entity_translation_translatable_switch', array($translatable, $field_name)), ); if ($field->hasData()) { - $field_operations[] = array('translation_entity_translatable_batch', array($translatable, $field_name)); + $field_operations[] = array('entity_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('entity_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' => 'entity_translation_translatable_batch_done', + 'file' => drupal_get_path('module', 'entity_translation') . '/entity_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 entity_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 entity_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 entity_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('entity_translation_translatable_batch', array(!$translatable, $field_name)), + array('entity_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' => 'entity_translation_translatable_batch_done', + 'file' => drupal_get_path('module', 'entity_translation') . '/entity_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 entity_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 entity_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); + _entity_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); + _entity_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); + _entity_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); + _entity_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 _entity_translation_update_field($entity_type, EntityInterface $entity, $field_name) { $empty = 0; $field = field_info_field($field_name); @@ -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 entity_translation_translatable_batch_done($success, $results, $operations) { if ($success) { drupal_set_message(t("Successfully changed field translation setting.")); } diff --git a/core/modules/translation_entity/translation_entity.install b/core/modules/translation_entity/translation_entity.install index 977d5fd..42c0e1b 100644 --- a/core/modules/translation_entity/translation_entity.install +++ b/core/modules/translation_entity/translation_entity.install @@ -10,8 +10,8 @@ /** * Implements hook_schema(). */ -function translation_entity_schema() { - $schema['translation_entity'] = array( +function entity_translation_schema() { + $schema['entity_translation'] = array( 'description' => 'Table to track entity translations', 'fields' => array( 'entity_type' => array( @@ -81,10 +81,10 @@ function translation_entity_schema() { /** * Implements hook_install(). */ -function translation_entity_install() { +function entity_translation_install() { // Assign a fairly low weight to ensure our implementation of // hook_module_implements_alter() is run among the last ones. - module_set_weight('translation_entity', 10); + module_set_weight('entity_translation', 10); language_negotiation_include(); language_negotiation_set(Language::TYPE_CONTENT, array(LANGUAGE_NEGOTIATION_URL => 0)); } @@ -92,7 +92,7 @@ function translation_entity_install() { /** * Implements hook_enable(). */ -function translation_entity_enable() { +function entity_translation_enable() { // Translation works when at least two languages are enabled. if (count(language_list()) < 2) { $t_args = array('!language_url' => url('admin/config/regional/language')); diff --git a/core/modules/translation_entity/translation_entity.module b/core/modules/translation_entity/translation_entity.module index dec0460..ff514fc 100644 --- a/core/modules/translation_entity/translation_entity.module +++ b/core/modules/translation_entity/translation_entity.module @@ -14,9 +14,9 @@ /** * Implements hook_help(). */ -function translation_entity_help($path, $arg) { +function entity_translation_help($path, $arg) { switch ($path) { - case 'admin/help#translation_entity': + case 'admin/help#entity_translation': $output = ''; $output .= '

' . t('About') . '

'; $output .= '

' . t('The Entity Translation module allows you to create and manage translations for your Drupal site content. You can specify which elements need to be translated at the content-type level for content items and comments, at the vocabulary level for taxonomy terms, and at the site level for user accounts. Other modules may provide additional elements that can be translated. For more information, see the online handbook entry for Entity Translation.', array('!url' => 'http://drupal.org/documentation/modules/entity_translation')) . '

'; @@ -32,7 +32,7 @@ function translation_entity_help($path, $arg) { $output .= '
' . t('Maintaining translations') . '
'; $output .= '
' . t('If editing content in one language requires that translated versions also be updated to reflect the change, use the Flag other translations as outdated check box to mark the translations as outdated and in need of revision.') . '
'; $output .= '
' . t('Translation permissions') . '
'; - $output .= '
' . t('The Entity Translation module makes a basic set of permissions available. Additional permissions are made available after translation is enabled for each translatable element.', array('@permissions' => url('admin/people/permissions', array('fragment' => 'module-translation_entity')))) . '
'; + $output .= '
' . t('The Entity Translation module makes a basic set of permissions available. Additional permissions are made available after translation is enabled for each translatable element.', array('@permissions' => url('admin/people/permissions', array('fragment' => 'module-entity_translation')))) . '
'; $output .= ''; return $output; @@ -48,14 +48,14 @@ function translation_entity_help($path, $arg) { /** * Implements hook_module_implements_alter(). */ -function translation_entity_module_implements_alter(&$implementations, $hook) { +function entity_translation_module_implements_alter(&$implementations, $hook) { switch ($hook) { // Move some of our hook implementations to the end of the list. case 'menu_alter': case 'entity_info_alter': - $group = $implementations['translation_entity']; - unset($implementations['translation_entity']); - $implementations['translation_entity'] = $group; + $group = $implementations['entity_translation']; + unset($implementations['entity_translation']); + $implementations['entity_translation'] = $group; break; } } @@ -63,7 +63,7 @@ function translation_entity_module_implements_alter(&$implementations, $hook) { /** * Implements hook_language_type_info_alter(). */ -function translation_entity_language_types_info_alter(array &$language_types) { +function entity_translation_language_types_info_alter(array &$language_types) { // Make content language negotiation configurable by removing its predefined // configuration. unset($language_types[Language::TYPE_CONTENT]['fixed']); @@ -72,22 +72,22 @@ function translation_entity_language_types_info_alter(array &$language_types) { /** * Implements hook_entity_info_alter(). */ -function translation_entity_entity_info_alter(array &$entity_info) { +function entity_translation_entity_info_alter(array &$entity_info) { // Provide defaults for translation info. foreach ($entity_info as $entity_type => &$info) { if (empty($info['translatable'])) { continue; } - if (!isset($info['translation']['translation_entity'])) { - $info['translation']['translation_entity'] = array(); + if (!isset($info['translation']['entity_translation'])) { + $info['translation']['entity_translation'] = array(); } // Every fieldable entity type must have a translation controller class, no // matter if it is enabled for translation or not. As a matter of fact we // might need it to correctly switch field translatability when a field is // shared accross different entities. - $info['controllers'] += array('translation' => 'Drupal\translation_entity\EntityTranslationController'); + $info['controllers'] += array('translation' => 'Drupal\entity_translation\EntityTranslationController'); // If no menu base path is provided we default to the usual // "entity_type/%entity_type" pattern. @@ -105,8 +105,8 @@ function translation_entity_entity_info_alter(array &$entity_info) { ); $entity_position = count(explode('/', $path)) - 1; - $info['translation']['translation_entity'] += array( - 'access_callback' => 'translation_entity_translate_access', + $info['translation']['entity_translation'] += array( + 'access_callback' => 'entity_translation_translate_access', 'access_arguments' => array($entity_position), ); } @@ -115,10 +115,10 @@ function translation_entity_entity_info_alter(array &$entity_info) { /** * Implements hook_entity_bundle_info_alter(). */ -function translation_entity_entity_bundle_info_alter(&$bundles) { +function entity_translation_entity_bundle_info_alter(&$bundles) { foreach ($bundles as $entity_type => &$info) { foreach ($info as $bundle => &$bundle_info) { - $enabled = translation_entity_get_config($entity_type, $bundle, 'enabled'); + $enabled = entity_translation_get_config($entity_type, $bundle, 'enabled'); $bundle_info['translatable'] = !empty($enabled); } } @@ -127,17 +127,17 @@ function translation_entity_entity_bundle_info_alter(&$bundles) { /** * Implements hook_menu(). */ -function translation_entity_menu() { +function entity_translation_menu() { $items = array(); // Create tabs for all possible entity types. foreach (entity_get_info() as $entity_type => $info) { // Provide the translation UI only for enabled types. - if (translation_entity_enabled($entity_type)) { + if (entity_translation_enabled($entity_type)) { $path = $info['menu_base_path']; $entity_position = count(explode('/', $path)) - 1; $keys = array_flip(array('theme_callback', 'theme_arguments', 'access_callback', 'access_arguments', 'load_arguments')); - $menu_info = array_intersect_key($info['translation']['translation_entity'], $keys) + array('file' => 'translation_entity.pages.inc'); + $menu_info = array_intersect_key($info['translation']['entity_translation'], $keys) + array('file' => 'entity_translation.pages.inc'); $item = array(); // Plugin annotations cannot contain spaces, thus we need to restore them @@ -148,7 +148,7 @@ function translation_entity_menu() { $items["$path/translations"] = array( 'title' => 'Translate', - 'page callback' => 'translation_entity_overview', + 'page callback' => 'entity_translation_overview', 'page arguments' => array($entity_position), 'type' => MENU_LOCAL_TASK, 'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE, @@ -168,9 +168,9 @@ function translation_entity_menu() { $args = array($entity_position, $language_position, $language_position + 1); $items["$path/translations/add/%language/%language"] = array( 'title' => 'Add', - 'page callback' => 'translation_entity_add_page', + 'page callback' => 'entity_translation_add_page', 'page arguments' => $args, - 'access callback' => 'translation_entity_add_access', + 'access callback' => 'entity_translation_add_access', 'access arguments' => $args, 'type' => MENU_LOCAL_TASK, 'weight' => 1, @@ -180,9 +180,9 @@ function translation_entity_menu() { $args = array($entity_position, $language_position); $items["$path/translations/edit/%language"] = array( 'title' => 'Edit', - 'page callback' => 'translation_entity_edit_page', + 'page callback' => 'entity_translation_edit_page', 'page arguments' => $args, - 'access callback' => 'translation_entity_edit_access', + 'access callback' => 'entity_translation_edit_access', 'access arguments' => $args, 'type' => MENU_LOCAL_TASK, 'weight' => 1, @@ -192,20 +192,20 @@ function translation_entity_menu() { $items["$path/translations/delete/%language"] = array( 'title' => 'Delete', 'page callback' => 'drupal_get_form', - 'page arguments' => array('translation_entity_delete_confirm', $entity_position, $language_position), - 'access callback' => 'translation_entity_delete_access', + 'page arguments' => array('entity_translation_delete_confirm', $entity_position, $language_position), + 'access callback' => 'entity_translation_delete_access', 'access arguments' => $args, ) + $item; } } - $items['admin/config/regional/translation_entity/translatable/%'] = array( + $items['admin/config/regional/entity_translation/translatable/%'] = array( 'title' => 'Confirm change in translatability.', 'description' => 'Confirm page for changing field translatability.', 'page callback' => 'drupal_get_form', - 'page arguments' => array('translation_entity_translatable_form', 5), + 'page arguments' => array('entity_translation_translatable_form', 5), 'access arguments' => array('administer entity translation'), - 'file' => 'translation_entity.admin.inc', + 'file' => 'entity_translation.admin.inc', ); return $items; @@ -214,10 +214,10 @@ function translation_entity_menu() { /** * Implements hook_menu_alter(). */ -function translation_entity_menu_alter(array &$items) { +function entity_translation_menu_alter(array &$items) { // Check that the declared menu base paths are actually valid. foreach (entity_get_info() as $entity_type => $info) { - if (translation_entity_enabled($entity_type)) { + if (entity_translation_enabled($entity_type)) { $path = $info['menu_base_path']; // If the base path is not defined we cannot provide the translation UI @@ -225,7 +225,7 @@ function translation_entity_menu_alter(array &$items) { // a menu loader associated, hence we need to check also for the plain "%" // variant. See for instance comment_menu(). if (!isset($items[$path]) && !isset($items["$path/edit"]) - && !isset($items[_translation_entity_menu_strip_loaders($path)])) { + && !isset($items[_entity_translation_menu_strip_loaders($path)])) { unset( $items["$path/translations"], $items["$path/translations/add/%language/%language"], @@ -267,7 +267,7 @@ function translation_entity_menu_alter(array &$items) { * @return * The given path where all the menu loaders are replaced with "%". */ -function _translation_entity_menu_strip_loaders($path) { +function _entity_translation_menu_strip_loaders($path) { return preg_replace('|%[^/]+|', '%', $path); } @@ -277,7 +277,7 @@ function _translation_entity_menu_strip_loaders($path) { * @param \Drupal\Core\Entity\EntityInterface $entity * The entity whose translation overview should be displayed. */ -function translation_entity_translate_access(EntityInterface $entity) { +function entity_translation_translate_access(EntityInterface $entity) { $entity_type = $entity->entityType(); return empty($entity->language()->locked) && language_multilingual() && $entity->isTranslatable() && (user_access('create entity translations') || user_access('update entity translations') || user_access('delete entity translations')); @@ -294,7 +294,7 @@ function translation_entity_translate_access(EntityInterface $entity) { * (optional) The account for which view access should be checked. Defaults to * the current user. */ -function translation_entity_view_access(EntityInterface $entity, $langcode, AccountInterface $account = NULL) { +function entity_translation_view_access(EntityInterface $entity, $langcode, AccountInterface $account = NULL) { $entity_type = $entity->entityType(); return !empty($entity->translation[$langcode]['status']) || user_access('translate any entity', $account) || user_access("translate $entity_type entities", $account); } @@ -311,12 +311,12 @@ function translation_entity_view_access(EntityInterface $entity, $langcode, Acco * (optional) The language of the translated values. Defaults to the current * content language. */ -function translation_entity_add_access(EntityInterface $entity, Language $source = NULL, Language $target = NULL) { +function entity_translation_add_access(EntityInterface $entity, Language $source = NULL, Language $target = NULL) { $source = !empty($source) ? $source : $entity->language(); $target = !empty($target) ? $target : language(Language::TYPE_CONTENT); $translations = $entity->getTranslationLanguages(); $languages = language_list(); - return $source->langcode != $target->langcode && isset($languages[$source->langcode]) && isset($languages[$target->langcode]) && !isset($translations[$target->langcode]) && translation_entity_access($entity, 'create'); + return $source->langcode != $target->langcode && isset($languages[$source->langcode]) && isset($languages[$target->langcode]) && !isset($translations[$target->langcode]) && entity_translation_access($entity, 'create'); } /** @@ -328,11 +328,11 @@ function translation_entity_add_access(EntityInterface $entity, Language $source * (optional) The language of the translated values. Defaults to the current * content language. */ -function translation_entity_edit_access(EntityInterface $entity, Language $language = NULL) { +function entity_translation_edit_access(EntityInterface $entity, Language $language = NULL) { $language = !empty($language) ? $language : language(Language::TYPE_CONTENT); $translations = $entity->getTranslationLanguages(); $languages = language_list(); - return isset($languages[$language->langcode]) && $language->langcode != $entity->language()->langcode && isset($translations[$language->langcode]) && translation_entity_access($entity, 'update'); + return isset($languages[$language->langcode]) && $language->langcode != $entity->language()->langcode && isset($translations[$language->langcode]) && entity_translation_access($entity, 'update'); } /** @@ -344,26 +344,26 @@ function translation_entity_edit_access(EntityInterface $entity, Language $langu * (optional) The language of the translated values. Defaults to the current * content language. */ -function translation_entity_delete_access(EntityInterface $entity, Language $language = NULL) { +function entity_translation_delete_access(EntityInterface $entity, Language $language = NULL) { $language = !empty($language) ? $language : language(Language::TYPE_CONTENT); $translations = $entity->getTranslationLanguages(); $languages = language_list(); - return isset($languages[$language->langcode]) && $language->langcode != $entity->language()->langcode && isset($translations[$language->langcode]) && translation_entity_access($entity, 'delete'); + return isset($languages[$language->langcode]) && $language->langcode != $entity->language()->langcode && isset($translations[$language->langcode]) && entity_translation_access($entity, 'delete'); } /** * Implements hook_library_info(). */ -function translation_entity_library_info() { - $path = drupal_get_path('module', 'translation_entity'); - $libraries['drupal.translation_entity.admin'] = array( +function entity_translation_library_info() { + $path = drupal_get_path('module', 'entity_translation'); + $libraries['drupal.entity_translation.admin'] = array( 'title' => 'Translation entity UI', 'version' => VERSION, 'js' => array( - $path . '/translation_entity.admin.js' => array(), + $path . '/entity_translation.admin.js' => array(), ), 'css' => array( - $path . '/css/translation_entity.admin.css' => array(), + $path . '/css/entity_translation.admin.css' => array(), ), 'dependencies' => array( array('system', 'jquery'), @@ -394,10 +394,10 @@ function translation_entity_library_info() { * @todo Generalize this logic so that it is available to any module needing * per-bundle configuration. */ -function translation_entity_get_config_key($entity_type, $bundle, $setting) { +function entity_translation_get_config_key($entity_type, $bundle, $setting) { $entity_type = preg_replace('/[^0-9a-zA-Z_]/', "_", $entity_type); $bundle = preg_replace('/[^0-9a-zA-Z_]/', "_", $bundle); - return $entity_type . '.' . $bundle . '.translation_entity.' . $setting; + return $entity_type . '.' . $bundle . '.entity_translation.' . $setting; } /** @@ -413,9 +413,9 @@ function translation_entity_get_config_key($entity_type, $bundle, $setting) { * @returns mixed * The stored value for the given setting. */ -function translation_entity_get_config($entity_type, $bundle, $setting) { - $key = translation_entity_get_config_key($entity_type, $bundle, $setting); - return config('translation_entity.settings')->get($key); +function entity_translation_get_config($entity_type, $bundle, $setting) { + $key = entity_translation_get_config_key($entity_type, $bundle, $setting); + return config('entity_translation.settings')->get($key); } /** @@ -430,9 +430,9 @@ function translation_entity_get_config($entity_type, $bundle, $setting) { * @param $value * The value to be stored for the given setting. */ -function translation_entity_set_config($entity_type, $bundle, $setting, $value) { - $key = translation_entity_get_config_key($entity_type, $bundle, $setting); - return config('translation_entity.settings')->set($key, $value)->save(); +function entity_translation_set_config($entity_type, $bundle, $setting, $value) { + $key = entity_translation_get_config_key($entity_type, $bundle, $setting); + return config('entity_translation.settings')->set($key, $value)->save(); } /** @@ -448,14 +448,14 @@ function translation_entity_set_config($entity_type, $bundle, $setting, $value) * TRUE if the specified bundle is translatable. If no bundle is provided * returns TRUE if at least one of the entity bundles is translatable. */ -function translation_entity_enabled($entity_type, $bundle = NULL) { +function entity_translation_enabled($entity_type, $bundle = NULL) { $enabled = FALSE; $info = entity_get_info($entity_type); if (!empty($info['translatable'])) { $bundles = !empty($bundle) ? array($bundle) : array_keys(entity_get_bundles($entity_type)); foreach ($bundles as $bundle) { - if (translation_entity_get_config($entity_type, $bundle, 'enabled')) { + if (entity_translation_get_config($entity_type, $bundle, 'enabled')) { $enabled = TRUE; break; } @@ -471,11 +471,11 @@ function translation_entity_enabled($entity_type, $bundle = NULL) { * @return array * An array of entity types keyed by entity type. */ -function translation_entity_types_translatable() { +function entity_translation_types_translatable() { $entity_types = &drupal_static(__FUNCTION__, array()); foreach (entity_get_info() as $entity_type => $info) { - if (translation_entity_enabled($entity_type)) { + if (entity_translation_enabled($entity_type)) { // Lazy load router items. if (!isset($items)) { $items = menu_get_router(); @@ -483,7 +483,7 @@ function translation_entity_types_translatable() { // Check whether the required paths are defined. We need to strip out the // menu loader and replace it with a plain "%" as router items have no // menu loader in them. - $path = _translation_entity_menu_strip_loaders($info['menu_base_path']); + $path = _entity_translation_menu_strip_loaders($info['menu_base_path']); if (!empty($items[$path]) && !empty($items[$path . '/translations'])) { $entity_types[$entity_type] = $entity_type; } @@ -499,10 +499,10 @@ function translation_entity_types_translatable() { * @param string $entity_type * The type of the entity being translated. * - * @return \Drupal\translation_entity\EntityTranslationControllerInterface + * @return \Drupal\entity_translation\EntityTranslationControllerInterface * An instance of the entity translation controller interface. */ -function translation_entity_controller($entity_type) { +function entity_translation_controller($entity_type) { $entity_info = entity_get_info($entity_type); // @todo Throw an exception if the key is missing. return new $entity_info['controllers']['translation']($entity_type, $entity_info); @@ -518,7 +518,7 @@ function translation_entity_controller($entity_type) { * An instance of the entity translation form interface or FALSE if not an * entity form. */ -function translation_entity_form_controller(array $form_state) { +function entity_translation_form_controller(array $form_state) { return isset($form_state['controller']) && $form_state['controller'] instanceof EntityFormControllerInterface ? $form_state['controller'] : FALSE; } @@ -537,14 +537,14 @@ function translation_entity_form_controller(array $form_state) { * @return * TRUE if the current user is allowed to view the translation. */ -function translation_entity_access(EntityInterface $entity, $op) { - return translation_entity_controller($entity->entityType())->getTranslationAccess($entity, $op) ; +function entity_translation_access(EntityInterface $entity, $op) { + return entity_translation_controller($entity->entityType())->getTranslationAccess($entity, $op) ; } /** * Implements hook_permission(). */ -function translation_entity_permission() { +function entity_translation_permission() { $permission = array( 'administer entity translation' => array( 'title' => t('Administer translation settings'), @@ -573,7 +573,7 @@ function translation_entity_permission() { switch ($info['permission_granularity']) { case 'bundle': foreach (entity_get_bundles($entity_type) as $bundle => $bundle_info) { - if (translation_entity_enabled($entity_type, $bundle)) { + if (entity_translation_enabled($entity_type, $bundle)) { $t_args['%bundle_label'] = isset($bundle_info['label']) ? $bundle_info['label'] : $bundle; $permission["translate $bundle $entity_type"] = array( 'title' => t('Translate %bundle_label @entity_label', $t_args), @@ -583,7 +583,7 @@ function translation_entity_permission() { break; case 'entity_type': - if (translation_entity_enabled($entity_type)) { + if (entity_translation_enabled($entity_type)) { $permission["translate $entity_type"] = array( 'title' => t('Translate @entity_label', $t_args), ); @@ -599,9 +599,9 @@ function translation_entity_permission() { /** * Implements hook_form_alter(). */ -function translation_entity_form_alter(array &$form, array &$form_state) { - if (($form_controller = translation_entity_form_controller($form_state)) && ($entity = $form_controller->getEntity()) && !$entity->isNew() && $entity->isTranslatable()) { - $controller = translation_entity_controller($entity->entityType()); +function entity_translation_form_alter(array &$form, array &$form_state) { + if (($form_controller = entity_translation_form_controller($form_state)) && ($entity = $form_controller->getEntity()) && !$entity->isNew() && $entity->isTranslatable()) { + $controller = entity_translation_controller($entity->entityType()); $controller->entityFormAlter($form, $form_state, $entity); // @todo Move the following lines to the code generating the property form @@ -637,18 +637,18 @@ function translation_entity_form_alter(array &$form, array &$form_state) { * * Performs language fallback for unaccessible translations. */ -function translation_entity_field_language_alter(&$display_language, $context) { +function entity_translation_field_language_alter(&$display_language, $context) { $entity = $context['entity']; $entity_type = $entity->entityType(); - if (isset($entity->translation[$context['langcode']]) && $entity->isTranslatable() && !translation_entity_view_access($entity, $context['langcode'])) { + if (isset($entity->translation[$context['langcode']]) && $entity->isTranslatable() && !entity_translation_view_access($entity, $context['langcode'])) { $instances = field_info_instances($entity_type, $entity->bundle()); // Avoid altering the real entity. $entity = clone($entity); $entity_langcode = $entity->language()->langcode; foreach ($entity->translation as $langcode => $translation) { - if ($langcode == $context['langcode'] || !translation_entity_view_access($entity, $langcode)) { + if ($langcode == $context['langcode'] || !entity_translation_view_access($entity, $langcode)) { // Unset unaccessible field translations: if the field is untranslatable // unsetting a language different from Language::LANGCODE_NOT_SPECIFIED has no // effect. @@ -672,10 +672,10 @@ function translation_entity_field_language_alter(&$display_language, $context) { /** * Implements hook_entity_load(). */ -function translation_entity_entity_load(array $entities, $entity_type) { +function entity_translation_entity_load(array $entities, $entity_type) { $enabled_entities = array(); - if (translation_entity_enabled($entity_type)) { + if (entity_translation_enabled($entity_type)) { foreach ($entities as $entity) { if ($entity->isTranslatable()) { $enabled_entities[$entity->id()] = $entity; @@ -684,7 +684,7 @@ function translation_entity_entity_load(array $entities, $entity_type) { } if (!empty($enabled_entities)) { - translation_entity_load_translation_metadata($enabled_entities, $entity_type); + entity_translation_load_translation_metadata($enabled_entities, $entity_type); } } @@ -696,8 +696,8 @@ function translation_entity_entity_load(array $entities, $entity_type) { * @param string $entity_type * The type of the entities. */ -function translation_entity_load_translation_metadata(array $entities, $entity_type) { - $query = 'SELECT * FROM {translation_entity} te WHERE te.entity_type = :entity_type AND te.entity_id IN (:entity_id)'; +function entity_translation_load_translation_metadata(array $entities, $entity_type) { + $query = 'SELECT * FROM {entity_translation} te WHERE te.entity_type = :entity_type AND te.entity_id IN (:entity_id)'; $result = db_query($query, array(':entity_type' => $entity_type, ':entity_id' => array_keys($entities))); $exclude = array('entity_type', 'entity_id', 'langcode'); foreach ($result as $record) { @@ -714,14 +714,14 @@ function translation_entity_load_translation_metadata(array $entities, $entity_t /** * Implements hook_entity_insert(). */ -function translation_entity_entity_insert(EntityInterface $entity) { +function entity_translation_entity_insert(EntityInterface $entity) { // Only do something if translation support for the given entity is enabled. if (!$entity->isTranslatable()) { return; } $fields = array('entity_type', 'entity_id', 'langcode', 'source', 'outdated', 'uid', 'status', 'created', 'changed'); - $query = db_insert('translation_entity')->fields($fields); + $query = db_insert('entity_translation')->fields($fields); foreach ($entity->getTranslationLanguages() as $langcode => $language) { $translation = isset($entity->translation[$langcode]) ? $entity->translation[$langcode] : array(); @@ -754,13 +754,13 @@ function translation_entity_entity_insert(EntityInterface $entity) { /** * Implements hook_entity_delete(). */ -function translation_entity_entity_delete(EntityInterface $entity) { +function entity_translation_entity_delete(EntityInterface $entity) { // Only do something if translation support for the given entity is enabled. if (!$entity->isTranslatable()) { return; } - db_delete('translation_entity') + db_delete('entity_translation') ->condition('entity_type', $entity->entityType()) ->condition('entity_id', $entity->id()) ->execute(); @@ -769,26 +769,26 @@ function translation_entity_entity_delete(EntityInterface $entity) { /** * Implements hook_entity_update(). */ -function translation_entity_entity_update(EntityInterface $entity) { +function entity_translation_entity_update(EntityInterface $entity) { // Only do something if translation support for the given entity is enabled. if (!$entity->isTranslatable()) { return; } // Delete and create to ensure no stale value remains behind. - translation_entity_entity_delete($entity); - translation_entity_entity_insert($entity); + entity_translation_entity_delete($entity); + entity_translation_entity_insert($entity); } /** * Implements hook_field_extra_fields(). */ -function translation_entity_field_extra_fields() { +function entity_translation_field_extra_fields() { $extra = array(); foreach (entity_get_info() as $entity_type => $info) { foreach (entity_get_bundles($entity_type) as $bundle => $bundle_info) { - if (translation_entity_enabled($entity_type, $bundle)) { + if (entity_translation_enabled($entity_type, $bundle)) { $extra[$entity_type][$bundle]['form']['translation'] = array( 'label' => t('Translation'), 'description' => t('Translation settings'), @@ -804,7 +804,7 @@ function translation_entity_field_extra_fields() { /** * Implements hook_form_FORM_ID_alter() for 'field_ui_field_edit_form'. */ -function translation_entity_form_field_ui_field_edit_form_alter(array &$form, array &$form_state, $form_id) { +function entity_translation_form_field_ui_field_edit_form_alter(array &$form, array &$form_state, $form_id) { $field = $form['#field']; $field_name = $field['field_name']; $translatable = $field['translatable']; @@ -819,7 +819,7 @@ function translation_entity_form_field_ui_field_edit_form_alter(array &$form, ar '#type' => 'link', '#prefix' => t('This field has data in existing content.') . ' ', '#title' => !$translatable ? t('Enable translation') : t('Disable translation'), - '#href' => 'admin/config/regional/translation_entity/translatable/' . $field_name, + '#href' => 'admin/config/regional/entity_translation/translatable/' . $field_name, '#options' => array('query' => drupal_get_destination()), '#access' => user_access('administer entity translation'), ), @@ -839,10 +839,10 @@ function translation_entity_form_field_ui_field_edit_form_alter(array &$form, ar /** * Implements hook_form_FORM_ID_alter() for 'field_ui_field_instance_edit_form'. */ -function translation_entity_form_field_ui_field_instance_edit_form_alter(array &$form, array &$form_state, $form_id) { +function entity_translation_form_field_ui_field_instance_edit_form_alter(array &$form, array &$form_state, $form_id) { if ($form['#field']['translatable']) { - module_load_include('inc', 'translation_entity', 'translation_entity.admin'); - $element = translation_entity_field_sync_widget($form['#field'], $form['#instance']); + module_load_include('inc', 'entity_translation', 'entity_translation.admin'); + $element = entity_translation_field_sync_widget($form['#field'], $form['#instance']); if ($element) { $form['instance']['settings']['translation_sync'] = $element; } @@ -852,7 +852,7 @@ function translation_entity_form_field_ui_field_instance_edit_form_alter(array & /** * Implements hook_field_info_alter(). */ -function translation_entity_field_info_alter(&$info) { +function entity_translation_field_info_alter(&$info) { foreach ($info as $field_type => &$field_type_info) { // By default no column has to be synchronized. $field_type_info['settings'] += array('translation_sync' => FALSE); @@ -864,19 +864,19 @@ function translation_entity_field_info_alter(&$info) { /** * Implements hook_field_attach_presave(). */ -function translation_entity_field_attach_presave(EntityInterface $entity) { +function entity_translation_field_attach_presave(EntityInterface $entity) { if ($entity->isTranslatable()) { $attributes = drupal_container()->get('request')->attributes; - Drupal::service('translation_entity.synchronizer')->synchronizeFields($entity, $attributes->get('working_langcode'), $attributes->get('source_langcode')); + Drupal::service('entity_translation.synchronizer')->synchronizeFields($entity, $attributes->get('working_langcode'), $attributes->get('source_langcode')); } } /** * Implements hook_element_info_alter(). */ -function translation_entity_element_info_alter(&$type) { +function entity_translation_element_info_alter(&$type) { if (isset($type['language_configuration'])) { - $type['language_configuration']['#process'][] = 'translation_entity_language_configuration_element_process'; + $type['language_configuration']['#process'][] = 'entity_translation_language_configuration_element_process'; } } @@ -897,14 +897,14 @@ function translation_entity_element_info_alter(&$type) { * @param array $form_state * The configuration form state array. */ -function translation_entity_enable_widget($entity_type, $bundle, array &$form, array &$form_state) { - $key = $form_state['translation_entity']['key']; +function entity_translation_enable_widget($entity_type, $bundle, array &$form, array &$form_state) { + $key = $form_state['entity_translation']['key']; if (!isset($form_state['language'][$key])) { $form_state['language'][$key] = array(); } $form_state['language'][$key] += array('entity_type' => $entity_type, 'bundle' => $bundle); - $element = translation_entity_language_configuration_element_process(array('#name' => $key), $form_state, $form); - unset($element['translation_entity']['#element_validate']); + $element = entity_translation_language_configuration_element_process(array('#name' => $key), $form_state, $form); + unset($element['entity_translation']['#element_validate']); return $element; } @@ -917,37 +917,37 @@ function translation_entity_enable_widget($entity_type, $bundle, array &$form, a * @return * Processed language configuration element. */ -function translation_entity_language_configuration_element_process(array $element, array &$form_state, array &$form) { - if (empty($element['#translation_entity_skip_alter']) && user_access('administer entity translation')) { - $form_state['translation_entity']['key'] = $element['#name']; +function entity_translation_language_configuration_element_process(array $element, array &$form_state, array &$form) { + if (empty($element['#entity_translation_skip_alter']) && user_access('administer entity translation')) { + $form_state['entity_translation']['key'] = $element['#name']; $context = $form_state['language'][$element['#name']]; - $element['translation_entity'] = array( + $element['entity_translation'] = array( '#type' => 'checkbox', '#title' => t('Enable translation'), - '#default_value' => translation_entity_enabled($context['entity_type'], $context['bundle']), - '#element_validate' => array('translation_entity_language_configuration_element_validate'), + '#default_value' => entity_translation_enabled($context['entity_type'], $context['bundle']), + '#element_validate' => array('entity_translation_language_configuration_element_validate'), '#prefix' => '', ); - $form['#submit'][] = 'translation_entity_language_configuration_element_submit'; + $form['#submit'][] = 'entity_translation_language_configuration_element_submit'; } return $element; } /** - * Form validation handler for element added with translation_entity_language_configuration_element_process(). + * Form validation handler for element added with entity_translation_language_configuration_element_process(). * * Checks whether translation can be enabled: if language is set to one of the * special languages and language selector is not hidden, translation cannot be * enabled. * - * @see translation_entity_language_configuration_element_submit() + * @see entity_translation_language_configuration_element_submit() */ -function translation_entity_language_configuration_element_validate($element, array &$form_state, array $form) { - $key = $form_state['translation_entity']['key']; +function entity_translation_language_configuration_element_validate($element, array &$form_state, array $form) { + $key = $form_state['entity_translation']['key']; $values = $form_state['values'][$key]; - if (language_is_locked($values['langcode']) && !$values['language_show'] && $values['translation_entity']) { + if (language_is_locked($values['langcode']) && !$values['language_show'] && $values['entity_translation']) { foreach (language_list(Language::STATE_LOCKED) as $language) { $locked_languages[] = $language->name; } @@ -959,19 +959,19 @@ function translation_entity_language_configuration_element_validate($element, ar } /** - * Form submission handler for element added with translation_entity_language_configuration_element_process(). + * Form submission handler for element added with entity_translation_language_configuration_element_process(). * * Stores the entity translation settings. * - * @see translation_entity_language_configuration_element_validate() + * @see entity_translation_language_configuration_element_validate() */ -function translation_entity_language_configuration_element_submit(array $form, array &$form_state) { - $key = $form_state['translation_entity']['key']; +function entity_translation_language_configuration_element_submit(array $form, array &$form_state) { + $key = $form_state['entity_translation']['key']; $context = $form_state['language'][$key]; - $enabled = $form_state['values'][$key]['translation_entity']; + $enabled = $form_state['values'][$key]['entity_translation']; - if (translation_entity_enabled($context['entity_type'], $context['bundle']) != $enabled) { - translation_entity_set_config($context['entity_type'], $context['bundle'], 'enabled', $enabled); + if (entity_translation_enabled($context['entity_type'], $context['bundle']) != $enabled) { + entity_translation_set_config($context['entity_type'], $context['bundle'], 'enabled', $enabled); entity_info_cache_clear(); menu_router_rebuild(); } @@ -980,17 +980,17 @@ function translation_entity_language_configuration_element_submit(array $form, a /** * Implements hook_form_FORM_ID_alter() for language_content_settings_form(). */ -function translation_entity_form_language_content_settings_form_alter(array &$form, array &$form_state) { - module_load_include('inc', 'translation_entity', 'translation_entity.admin'); - _translation_entity_form_language_content_settings_form_alter($form, $form_state); +function entity_translation_form_language_content_settings_form_alter(array &$form, array &$form_state) { + module_load_include('inc', 'entity_translation', 'entity_translation.admin'); + _entity_translation_form_language_content_settings_form_alter($form, $form_state); } /** * Implements hook_preprocess_HOOK() for theme_language_content_settings_table(). */ -function translation_entity_preprocess_language_content_settings_table(&$variables) { - module_load_include('inc', 'translation_entity', 'translation_entity.admin'); - _translation_entity_preprocess_language_content_settings_table($variables); +function entity_translation_preprocess_language_content_settings_table(&$variables) { + module_load_include('inc', 'entity_translation', 'entity_translation.admin'); + _entity_translation_preprocess_language_content_settings_table($variables); } /** @@ -1007,13 +1007,13 @@ function translation_entity_preprocess_language_content_settings_table(&$variabl * - columns: An associative array of translation synchronization settings * keyed by field names. */ -function translation_entity_save_settings($settings) { +function entity_translation_save_settings($settings) { foreach ($settings as $entity_type => $entity_settings) { foreach ($entity_settings as $bundle => $bundle_settings) { // The 'translatable' value is set only if it is possible to enable. if (isset($bundle_settings['translatable'])) { // Store whether a bundle has translation enabled or not. - translation_entity_set_config($entity_type, $bundle, 'enabled', $bundle_settings['translatable']); + entity_translation_set_config($entity_type, $bundle, 'enabled', $bundle_settings['translatable']); // Store whether fields have translation enabled or not. if (!empty($bundle_settings['columns'])) { diff --git a/core/modules/translation_entity/translation_entity.pages.inc b/core/modules/translation_entity/translation_entity.pages.inc index cd212eb..9898ac1 100644 --- a/core/modules/translation_entity/translation_entity.pages.inc +++ b/core/modules/translation_entity/translation_entity.pages.inc @@ -15,8 +15,8 @@ * @param \Drupal\Core\Entity\EntityInterface $entity * The entity whose translation overview should be displayed. */ -function translation_entity_overview(EntityInterface $entity) { - $controller = translation_entity_controller($entity->entityType()); +function entity_translation_overview(EntityInterface $entity) { + $controller = entity_translation_controller($entity->entityType()); $entity_manager = Drupal::entityManager(); $languages = language_list(); $original = $entity->language()->langcode; @@ -34,7 +34,7 @@ function translation_entity_overview(EntityInterface $entity) { // If we have a view path defined for the current entity get the switch // links based on it. if ($path) { - $links = _translation_entity_get_switch_links($path); + $links = _entity_translation_get_switch_links($path); } // Determine whether the current entity is translatable. @@ -56,10 +56,10 @@ function translation_entity_overview(EntityInterface $entity) { $delete_path = $base_path . '/translations/delete/' . $langcode; if ($base_path) { - $add_links = _translation_entity_get_switch_links($add_path); - $edit_links = _translation_entity_get_switch_links($edit_path); - $translate_links = _translation_entity_get_switch_links($translate_path); - $delete_links = _translation_entity_get_switch_links($delete_path); + $add_links = _entity_translation_get_switch_links($add_path); + $edit_links = _entity_translation_get_switch_links($edit_path); + $translate_links = _entity_translation_get_switch_links($translate_path); + $delete_links = _entity_translation_get_switch_links($delete_path); } $operations = array( @@ -146,7 +146,7 @@ function translation_entity_overview(EntityInterface $entity) { // which entity this is. $build['#entity'] = $entity; - $build['translation_entity_overview'] = array( + $build['entity_translation_overview'] = array( '#theme' => 'table', '#header' => $header, '#rows' => $rows, @@ -164,7 +164,7 @@ function translation_entity_overview(EntityInterface $entity) { * @returns * A renderable array of language switch links. */ -function _translation_entity_get_switch_links($path) { +function _entity_translation_get_switch_links($path) { $links = language_negotiation_get_switch_links(Language::TYPE_CONTENT, $path); if (empty($links)) { // If content language is set up to fall back to the interface language, @@ -190,18 +190,18 @@ function _translation_entity_get_switch_links($path) { * @return array * A processed form array ready to be rendered. */ -function translation_entity_add_page(EntityInterface $entity, Language $source = NULL, Language $target = NULL) { +function entity_translation_add_page(EntityInterface $entity, Language $source = NULL, Language $target = NULL) { $source = !empty($source) ? $source : $entity->language(); $target = !empty($target) ? $target : language(Language::TYPE_CONTENT); // @todo Exploit the upcoming hook_entity_prepare() when available. - translation_entity_prepare_translation($entity, $source, $target); + entity_translation_prepare_translation($entity, $source, $target); $info = $entity->entityInfo(); $operation = isset($info['default_operation']) ? $info['default_operation'] : 'default'; $form_state['langcode'] = $target->langcode; - $form_state['translation_entity']['source'] = $source; - $form_state['translation_entity']['target'] = $target; - $controller = translation_entity_controller($entity->entityType()); - $form_state['translation_entity']['translation_form'] = !$controller->getAccess($entity, 'update'); + $form_state['entity_translation']['source'] = $source; + $form_state['entity_translation']['target'] = $target; + $controller = entity_translation_controller($entity->entityType()); + $form_state['entity_translation']['translation_form'] = !$controller->getAccess($entity, 'update'); return Drupal::entityManager()->getForm($entity, $operation, $form_state); } @@ -217,12 +217,12 @@ function translation_entity_add_page(EntityInterface $entity, Language $source = * @return array * A processed form array ready to be rendered. */ -function translation_entity_edit_page(EntityInterface $entity, Language $language = NULL) { +function entity_translation_edit_page(EntityInterface $entity, Language $language = NULL) { $language = !empty($language) ? $language : language(Language::TYPE_CONTENT); $info = $entity->entityInfo(); $operation = isset($info['default_operation']) ? $info['default_operation'] : 'default'; $form_state['langcode'] = $language->langcode; - $form_state['translation_entity']['translation_form'] = TRUE; + $form_state['entity_translation']['translation_form'] = TRUE; return Drupal::entityManager()->getForm($entity, $operation, $form_state); } @@ -236,7 +236,7 @@ function translation_entity_edit_page(EntityInterface $entity, Language $languag * @param \Drupal\Core\Language\Language $target * The language to be used as target. */ -function translation_entity_prepare_translation(EntityInterface $entity, Language $source, Language $target) { +function entity_translation_prepare_translation(EntityInterface $entity, Language $source, Language $target) { // @todo Unify field and property handling. $instances = field_info_instances($entity->entityType(), $entity->bundle()); $entity = $entity->getNGEntity(); @@ -265,9 +265,9 @@ function translation_entity_prepare_translation(EntityInterface $entity, Languag /** * Form constructor for the translation deletion confirmation. */ -function translation_entity_delete_confirm(array $form, array $form_state, EntityInterface $entity, Language $language) { +function entity_translation_delete_confirm(array $form, array $form_state, EntityInterface $entity, Language $language) { $langcode = $language->langcode; - $controller = translation_entity_controller($entity->entityType()); + $controller = entity_translation_controller($entity->entityType()); return confirm_form( $form, @@ -280,11 +280,11 @@ function translation_entity_delete_confirm(array $form, array $form_state, Entit } /** - * Form submission handler for translation_entity_delete_confirm(). + * Form submission handler for entity_translation_delete_confirm(). */ -function translation_entity_delete_confirm_submit(array $form, array &$form_state) { +function entity_translation_delete_confirm_submit(array $form, array &$form_state) { list($entity, $language) = $form_state['build_info']['args']; - $controller = translation_entity_controller($entity->entityType()); + $controller = entity_translation_controller($entity->entityType()); // Remove the translated values. $controller->removeTranslation($entity, $language->langcode); diff --git a/core/modules/translation_entity/translation_entity.services.yml b/core/modules/translation_entity/translation_entity.services.yml index 541bd3d..4b84d16 100644 --- a/core/modules/translation_entity/translation_entity.services.yml +++ b/core/modules/translation_entity/translation_entity.services.yml @@ -1,4 +1,4 @@ services: - translation_entity.synchronizer: - class: Drupal\translation_entity\FieldTranslationSynchronizer + entity_translation.synchronizer: + class: Drupal\entity_translation\FieldTranslationSynchronizer arguments: ['@plugin.manager.entity'] diff --git a/core/modules/user/config/views.view.user_admin_people.yml b/core/modules/user/config/views.view.user_admin_people.yml index efaca3c..32d2489 100644 --- a/core/modules/user/config/views.view.user_admin_people.yml +++ b/core/modules/user/config/views.view.user_admin_people.yml @@ -548,7 +548,7 @@ display: hide_alter_empty: '1' text: Translate optional: '1' - plugin_id: translation_entity_link + plugin_id: entity_translation_link dropbutton: id: dropbutton table: views diff --git a/core/modules/user/lib/Drupal/user/AccountSettingsForm.php b/core/modules/user/lib/Drupal/user/AccountSettingsForm.php index 5c8880b..e38db7c 100644 --- a/core/modules/user/lib/Drupal/user/AccountSettingsForm.php +++ b/core/modules/user/lib/Drupal/user/AccountSettingsForm.php @@ -98,14 +98,14 @@ public function buildForm(array $form, array &$form_state) { ); // @todo Remove this check once language settings are generalized. - if ($this->moduleHandler->moduleExists('translation_entity')) { + if ($this->moduleHandler->moduleExists('entity_translation')) { $form['language'] = array( '#type' => 'details', '#title' => t('Language settings'), '#tree' => TRUE, ); - $form_state['translation_entity']['key'] = 'language'; - $form['language'] += translation_entity_enable_widget('user', 'user', $form, $form_state); + $form_state['entity_translation']['key'] = 'language'; + $form['language'] += entity_translation_enable_widget('user', 'user', $form, $form_state); } // User registration settings. diff --git a/core/modules/user/lib/Drupal/user/ProfileTranslationController.php b/core/modules/user/lib/Drupal/user/ProfileTranslationController.php index c1b2414..b9e5adf 100644 --- a/core/modules/user/lib/Drupal/user/ProfileTranslationController.php +++ b/core/modules/user/lib/Drupal/user/ProfileTranslationController.php @@ -8,7 +8,7 @@ namespace Drupal\user; use Drupal\Core\Entity\EntityInterface; -use Drupal\translation_entity\EntityTranslationController; +use Drupal\entity_translation\EntityTranslationController; /** * Defines the translation controller class for terms. @@ -32,7 +32,7 @@ public function entityFormAlter(array &$form, array &$form_state, EntityInterfac */ function entityFormSave(array $form, array &$form_state) { if ($this->getSourceLangcode($form_state)) { - $entity = translation_entity_form_controller($form_state)->getEntity(); + $entity = entity_translation_form_controller($form_state)->getEntity(); // We need a redirect here, otherwise we would get an access denied page // since the current URL would be preserved and we would try to add a // translation for a language that already has a translation. diff --git a/core/modules/user/lib/Drupal/user/Tests/UserTranslationUITest.php b/core/modules/user/lib/Drupal/user/Tests/UserTranslationUITest.php index d92754e..10d94d4 100644 --- a/core/modules/user/lib/Drupal/user/Tests/UserTranslationUITest.php +++ b/core/modules/user/lib/Drupal/user/Tests/UserTranslationUITest.php @@ -7,7 +7,7 @@ namespace Drupal\user\Tests; -use Drupal\translation_entity\Tests\EntityTranslationUITest; +use Drupal\entity_translation\Tests\EntityTranslationUITest; /** * Tests the User Translation UI. @@ -24,7 +24,7 @@ class UserTranslationUITest extends EntityTranslationUITest { * * @var array */ - public static $modules = array('language', 'translation_entity', 'user', 'views'); + public static $modules = array('language', 'entity_translation', 'user', 'views'); public static function getInfo() { return array( @@ -44,14 +44,14 @@ function setUp() { } /** - * Overrides \Drupal\translation_entity\Tests\EntityTranslationUITest::getTranslatorPermission(). + * Overrides \Drupal\entity_translation\Tests\EntityTranslationUITest::getTranslatorPermission(). */ protected function getTranslatorPermissions() { return array_merge(parent::getTranslatorPermissions(), array('administer users')); } /** - * Overrides \Drupal\translation_entity\Tests\EntityTranslationUITest::getNewEntityValues(). + * Overrides \Drupal\entity_translation\Tests\EntityTranslationUITest::getNewEntityValues(). */ protected function getNewEntityValues($langcode) { // User name is not translatable hence we use a fixed value. diff --git a/core/modules/user/user.admin.inc b/core/modules/user/user.admin.inc index f9982e8..964a228 100644 --- a/core/modules/user/user.admin.inc +++ b/core/modules/user/user.admin.inc @@ -68,7 +68,7 @@ function user_admin_account() { 'href' => 'user/' . $account->uid . '/edit', 'query' => $destination, ); - if (module_invoke('translation_entity', 'translate_access', $account)) { + if (module_invoke('entity_translation', 'translate_access', $account)) { $links['translate'] = array( 'title' => t('Translate'), 'href' => 'user/' . $account->uid . '/translations', diff --git a/core/modules/user/user.views.inc b/core/modules/user/user.views.inc index 0cc88ce..dcaf214 100644 --- a/core/modules/user/user.views.inc +++ b/core/modules/user/user.views.inc @@ -281,12 +281,12 @@ function user_views_data() { ), ); - if (Drupal::moduleHandler()->moduleExists('translation_entity')) { + if (Drupal::moduleHandler()->moduleExists('entity_translation')) { $data['users']['translation_link'] = array( 'title' => t('Translation link'), 'help' => t('Provide a link to the translations overview for users.'), 'field' => array( - 'id' => 'translation_entity_link', + 'id' => 'entity_translation_link', ), ); }