Browse Source

Issue #2994996 by aangel: Field access check should test using language

merge-requests/4/head
Chi 4 years ago
parent
commit
84c486c2ed
  1. 3
      src/TwigExtension.php

3
src/TwigExtension.php

@ -622,10 +622,9 @@ class TwigExtension extends \Twig_Extension {
}
if ($entity) {
$entity = \Drupal::service('entity.repository')->getTranslationFromContext($entity, $langcode);
$access = $check_access ? $entity->access('view', NULL, TRUE) : AccessResult::allowed();
if ($access->isAllowed()) {
$entity = \Drupal::service('entity.repository')
->getTranslationFromContext($entity, $langcode);
if (isset($entity->{$field_name})) {
$build = $entity->{$field_name}->view($view_mode);
CacheableMetadata::createFromRenderArray($build)

Loading…
Cancel
Save