Conditions | 7 |
Paths | 6 |
Total Lines | 20 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
25 | public function resolveValues($value, array $args, ResolveInfo $info) { |
||
26 | if ($value instanceof FieldableEntityInterface) { |
||
27 | $fieldName = $this->getPluginDefinition()['field']; |
||
28 | if ($value->hasField($fieldName)) { |
||
29 | /** @var \Drupal\Core\Field\FieldItemListInterface $items */ |
||
30 | $items = $value->get($fieldName); |
||
31 | |||
32 | if (($access = $items->access('view', NULL, TRUE)) && $access->isAllowed()) { |
||
33 | foreach ($items as $item) { |
||
34 | if (!empty($this->getPluginDefinition()['property'])) { |
||
35 | yield new CacheableValue($this->resolveItem($item, $args, $info), [$access]); |
||
36 | } |
||
37 | else { |
||
38 | yield new CacheableValue($item, [$access]); |
||
39 | } |
||
40 | } |
||
41 | } |
||
42 | } |
||
43 | } |
||
44 | } |
||
45 | |||
47 |