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('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 .= '