| Conditions | 3 |
| Paths | 3 |
| Total Lines | 26 |
| Code Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | protected function getDerivativeDefinitionsFromFieldDefinition($entityTypeId, FieldStorageDefinitionInterface $fieldDefinition, array $basePluginDefinition, $bundleId = NULL) { |
||
| 16 | $derivatives = []; |
||
| 17 | $fieldName = $fieldDefinition->getName(); |
||
| 18 | $commonDefinition = [ |
||
| 19 | 'parents' => [EntityFieldType::getId($entityTypeId, $fieldName)], |
||
| 20 | 'schema_cache_tags' => array_merge($fieldDefinition->getCacheTags(), ['entity_field_info']), |
||
| 21 | 'schema_cache_contexts' => $fieldDefinition->getCacheContexts(), |
||
| 22 | 'schema_cache_max_age' => $fieldDefinition->getCacheMaxAge(), |
||
| 23 | ]; |
||
| 24 | |||
| 25 | foreach ($fieldDefinition->getPropertyDefinitions() as $property => $propertyDefinition) { |
||
| 26 | if ($propertyDefinition->getDataType() == 'map') { |
||
| 27 | // TODO Is it possible to get the keys of a map (eg. the options array for link field) here? |
||
| 28 | continue; |
||
| 29 | } |
||
| 30 | |||
| 31 | $derivatives["$entityTypeId-$fieldName-$property"] = [ |
||
| 32 | 'name' => StringHelper::propCase($property), |
||
| 33 | 'property' => $property, |
||
| 34 | 'multi' => FALSE, |
||
| 35 | 'type' => $this->typeMapper->typedDataToGraphQLFieldType($propertyDefinition), |
||
| 36 | ] + $commonDefinition + $basePluginDefinition; |
||
| 37 | } |
||
| 38 | |||
| 39 | return $derivatives; |
||
| 40 | } |
||
| 41 | |||
| 43 |