$lang_code = \Drupal::service('language_manager')->getCurrentLanguage()->getId();
$node = \Drupal::routeMatch()->getParameter('node');
// Paragraphs/referencedEntities
$paras = $node->get('entity_fiedld_name')->referencedEntities();
foreach ($paras as $para) {
// Remember to check if translation exists
if ($para->hasTranslation($lang_code)) {
$para = $para->getTranslation($lang_code);
}
$goodValue = $para->get('field_of_the_entity')->getValue();
}
File for functions of entity:
core/lib/Drupal/Core/Entity ContentEntityBase.php
No comments:
Post a Comment