| Conditions | 6 |
| Paths | 5 |
| Total Lines | 22 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | protected function getDerivativeDefinitionsFromFieldDefinition(FieldDefinitionInterface $fieldDefinition, array $basePluginDefinition) { |
||
| 15 | $fieldType = $fieldDefinition->getType(); |
||
| 16 | |||
| 17 | if (isset($basePluginDefinition['field_types']) && in_array($fieldType, $basePluginDefinition['field_types'])) { |
||
| 18 | $fieldName = $fieldDefinition->getName(); |
||
| 19 | $fieldBundle = $fieldDefinition->getTargetBundle() ?: ''; |
||
| 20 | $entityTypeId = $fieldDefinition->getTargetEntityTypeId(); |
||
| 21 | $entityType = $this->entityTypeManager->getDefinition($entityTypeId); |
||
| 22 | $supportsBundles = $entityType->hasKey('bundle'); |
||
| 23 | |||
| 24 | if (!isset($basePluginDefinition['parents'])) { |
||
| 25 | $basePluginDefinition['parents'] = []; |
||
| 26 | } |
||
| 27 | |||
| 28 | $parents = [StringHelper::camelCase('field', $entityTypeId, $supportsBundles ? $fieldBundle : '', $fieldName)]; |
||
| 29 | return ["$entityTypeId-$fieldBundle-$fieldName" => [ |
||
| 30 | 'parents' => array_merge($parents, $basePluginDefinition['parents']), |
||
| 31 | ] + $basePluginDefinition]; |
||
| 32 | } |
||
| 33 | |||
| 34 | return []; |
||
| 35 | } |
||
| 36 | } |
||
| 37 |