Browse Source

Issue #3222014 by sonfd: Allow custom display settings for drupal_field()

3.1.x 3.1.2
sonfd 3 years ago committed by Chi
parent
commit
3c8c1751ce
  1. 2
      src/TwigTweakExtension.php

2
src/TwigTweakExtension.php

@ -192,7 +192,7 @@ class TwigTweakExtension extends AbstractExtension {
/** /**
* Returns the render array for a single entity field. * Returns the render array for a single entity field.
*/ */
public static function drupalField(string $field_name, string $entity_type, string $id, string $view_mode = 'full', string $langcode = NULL, bool $check_access = TRUE): array { public static function drupalField(string $field_name, string $entity_type, string $id, $view_mode = 'full', string $langcode = NULL, bool $check_access = TRUE): array {
$entity = \Drupal::entityTypeManager()->getStorage($entity_type)->load($id); $entity = \Drupal::entityTypeManager()->getStorage($entity_type)->load($id);
if ($entity) { if ($entity) {
return \Drupal::service('twig_tweak.field_view_builder') return \Drupal::service('twig_tweak.field_view_builder')

Loading…
Cancel
Save