modules/graphql_core/src/Plugin/GraphQL/Fields/Entity/Fields/Link/LinkAttribute.php 1 location
|
@@ 25-37 (lines=13) @@
|
| 22 |
|
* deriver = "Drupal\graphql_core\Plugin\Deriver\Fields\EntityFieldPropertyDeriver" |
| 23 |
|
* ) |
| 24 |
|
*/ |
| 25 |
|
class LinkAttribute extends FieldPluginBase { |
| 26 |
|
|
| 27 |
|
/** |
| 28 |
|
* {@inheritdoc} |
| 29 |
|
*/ |
| 30 |
|
protected function resolveValues($value, array $args, ResolveInfo $info) { |
| 31 |
|
if ($value instanceof LinkItemInterface) { |
| 32 |
|
$options = $value->getUrl()->getOptions(); |
| 33 |
|
yield NestedArray::getValue($options, ['attributes', $args['key']]); |
| 34 |
|
} |
| 35 |
|
} |
| 36 |
|
|
| 37 |
|
} |
| 38 |
|
|
modules/graphql_core/src/Plugin/GraphQL/Fields/MenuLink/MenuLinkAttribute.php 1 location
|
@@ 24-36 (lines=13) @@
|
| 21 |
|
* } |
| 22 |
|
* ) |
| 23 |
|
*/ |
| 24 |
|
class MenuLinkAttribute extends FieldPluginBase { |
| 25 |
|
|
| 26 |
|
/** |
| 27 |
|
* {@inheritdoc} |
| 28 |
|
*/ |
| 29 |
|
protected function resolveValues($value, array $args, ResolveInfo $info) { |
| 30 |
|
if ($value instanceof MenuLinkTreeElement) { |
| 31 |
|
$options = $value->link->getOptions(); |
| 32 |
|
yield NestedArray::getValue($options, ['attributes', $args['key']]); |
| 33 |
|
} |
| 34 |
|
} |
| 35 |
|
|
| 36 |
|
} |
| 37 |
|
|