summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancesco Placella2012-10-06 23:26:04 (GMT)
committer Francesco Placella2012-10-06 23:26:04 (GMT)
commit82940ae1be7b153ee6d895c507e1071bcf7206ce (patch)
tree1368e20bd59882bcff88e90ad215265b02b4a2a4
parent8252e9e12e0daa6f5dc30e02e41ef60430276a94 (diff)
Issue #1188388: Replaced deprecated calls to EntityInterface::translations()
-rw-r--r--core/modules/node/node.module4
-rw-r--r--core/modules/translation_entity/lib/Drupal/translation_entity/EntityTranslationController.php8
-rw-r--r--core/modules/translation_entity/translation_entity.module4
-rw-r--r--core/modules/translation_entity/translation_entity.pages.inc2
4 files changed, 9 insertions, 9 deletions
diff --git a/core/modules/node/node.module b/core/modules/node/node.module
index cb13df2..eeab29b 100644
--- a/core/modules/node/node.module
+++ b/core/modules/node/node.module
@@ -2683,7 +2683,7 @@ function node_update_index() {
$counter = 0;
foreach (node_load_multiple($nids) as $node) {
// Determine when the maximum number of indexable items is reached.
- $counter += count($node->translations());
+ $counter += count($node->getTranslationLanguages());
if ($counter > $limit) {
break;
}
@@ -2703,7 +2703,7 @@ function _node_index_node(Node $node) {
// results half-life calculation.
variable_set('node_cron_last', $node->changed);
- $languages = $node->translations();
+ $languages = $node->getTranslationLanguages();
foreach ($languages as $language) {
// Render the node.
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 226d80c..39d3013 100644
--- a/core/modules/translation_entity/lib/Drupal/translation_entity/EntityTranslationController.php
+++ b/core/modules/translation_entity/lib/Drupal/translation_entity/EntityTranslationController.php
@@ -32,7 +32,7 @@ class EntityTranslationController implements EntityTranslationControllerInterfac
* Implements EntityTranslationControllerInterface::removeTranslation().
*/
public function removeTranslation(EntityInterface $entity, $langcode) {
- $translations = $entity->translations();
+ $translations = $entity->getTranslationLanguages();
// @todo Handle properties.
// Remove field translations.
foreach (field_info_instances($entity->entityType(), $entity->bundle()) as $instance) {
@@ -49,7 +49,7 @@ class EntityTranslationController implements EntityTranslationControllerInterfac
*/
public function retranslate(EntityInterface $entity, $langcode = NULL) {
$updated_langcode = !empty($langcode) ? $langcode : $entity->language()->langcode;
- $translations = $entity->translations();
+ $translations = $entity->getTranslationLanguages();
foreach ($translations as $langcode => $language) {
$entity->retranslate[$langcode] = $langcode != $updated_langcode;
}
@@ -108,7 +108,7 @@ class EntityTranslationController implements EntityTranslationControllerInterfac
$source_langcode = $this->getSourceLangcode($form_state);
$new_translation = !empty($source_langcode);
- $translations = $entity->translations();
+ $translations = $entity->getTranslationLanguages();
if ($new_translation) {
// Make sure a new translation does not appear as existing yet.
unset($translations[$form_langcode]);
@@ -274,7 +274,7 @@ class EntityTranslationController implements EntityTranslationControllerInterfac
function entityFormDelete($form, &$form_state) {
$form_controller = translation_entity_form_controller($form_state);
$entity = $form_controller->getEntity($form_state);
- if (count($entity->translations()) > 1) {
+ if (count($entity->getTranslationLanguages()) > 1) {
$info = $entity->entityInfo();
drupal_set_message(t('This will delete all the @entity_type translations.', array('@entity_type' => drupal_strtolower($info['label']))), 'warning');
}
diff --git a/core/modules/translation_entity/translation_entity.module b/core/modules/translation_entity/translation_entity.module
index 13ff511..cfe928b 100644
--- a/core/modules/translation_entity/translation_entity.module
+++ b/core/modules/translation_entity/translation_entity.module
@@ -187,7 +187,7 @@ function translation_entity_tab_access(EntityInterface $entity) {
function translation_entity_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->translations();
+ $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, $target->langcode);
}
@@ -355,7 +355,7 @@ function translation_entity_entity_insert(EntityInterface $entity) {
$query = db_insert('translation_entity')
->fields(array('entity_type', 'entity_id', 'langcode', 'source', 'translate'));
- foreach ($entity->translations() as $langcode => $language) {
+ foreach ($entity->getTranslationLanguages() as $langcode => $language) {
// @todo Declare these as entity (translation?) properties.
$source = (isset($entity->source[$langcode]) ? $entity->source[$langcode] : NULL) . '';
$retranslate = intval(!empty($entity->retranslate[$langcode]));
diff --git a/core/modules/translation_entity/translation_entity.pages.inc b/core/modules/translation_entity/translation_entity.pages.inc
index eb6a1a5..050b43d 100644
--- a/core/modules/translation_entity/translation_entity.pages.inc
+++ b/core/modules/translation_entity/translation_entity.pages.inc
@@ -17,7 +17,7 @@ function translation_entity_overview(EntityInterface $entity) {
$controller = translation_entity_controller($entity->entityType());
$languages = language_list();
$original = $entity->language()->langcode;
- $translations = $entity->translations();
+ $translations = $entity->getTranslationLanguages();
$path = $controller->getViewPath($entity);
$base_path = $controller->getBasePath($entity);