Skip to content
Snippets Groups Projects
Commit 06eff5fa authored by Hristo Chonov's avatar Hristo Chonov Committed by Sascha Grossenbacher
Browse files

Issue #2940988 by hchonov, kala4ek, urvashi_vora: Paragraph's summary is not...

Issue #2940988 by hchonov, kala4ek, urvashi_vora: Paragraph's summary is not using the translated referenced entity for the summary
parent 98af9c51
No related branches found
No related tags found
1 merge request!47Issue #2940988: Paragraph's summary is not using the translated referenced entity for the summary
Pipeline #246191 passed with warnings
...@@ -501,7 +501,7 @@ class Paragraph extends ContentEntityBase implements ParagraphInterface { ...@@ -501,7 +501,7 @@ class Paragraph extends ContentEntityBase implements ParagraphInterface {
foreach ($referenced_entities as $referenced_entity) { foreach ($referenced_entities as $referenced_entity) {
if ($referenced_entity->access('view label')) { if ($referenced_entity->access('view label')) {
// Switch to the entity translation in the current context. // Switch to the entity translation in the current context.
$entity = \Drupal::service('entity.repository')->getTranslationFromContext($referenced_entity, $this->activeLangcode); $entity = \Drupal::service('entity.repository')->getTranslationFromContext($referenced_entity, $this->language()->getId());
$summary['content'][] = $entity->label(); $summary['content'][] = $entity->label();
} }
} }
...@@ -702,7 +702,7 @@ class Paragraph extends ContentEntityBase implements ParagraphInterface { ...@@ -702,7 +702,7 @@ class Paragraph extends ContentEntityBase implements ParagraphInterface {
$entity = $item->entity; $entity = $item->entity;
if ($entity instanceof ParagraphInterface) { if ($entity instanceof ParagraphInterface) {
// Switch to the entity translation in the current context if exists. // Switch to the entity translation in the current context if exists.
$entity = \Drupal::service('entity.repository')->getTranslationFromContext($entity, $this->activeLangcode); $entity = \Drupal::service('entity.repository')->getTranslationFromContext($entity, $this->language()->getId());
$content_summary_items = $entity->getSummaryItems($options)['content']; $content_summary_items = $entity->getSummaryItems($options)['content'];
$summary_content = array_merge($summary_content, array_values($content_summary_items)); $summary_content = array_merge($summary_content, array_values($content_summary_items));
$this->summaryCount++; $this->summaryCount++;
...@@ -756,5 +756,4 @@ class Paragraph extends ContentEntityBase implements ParagraphInterface { ...@@ -756,5 +756,4 @@ class Paragraph extends ContentEntityBase implements ParagraphInterface {
return $summary; return $summary;
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment