private function FieldValueExtension::getParentObjectKey in Twig Field Value 2.0.x
Same name and namespace in other branches
- 8 src/Twig/Extension/FieldValueExtension.php \Drupal\twig_field_value\Twig\Extension\FieldValueExtension::getParentObjectKey()
Determine the build array key of the parent object.
Different field types use different key names.
Parameters
array $build: Render array.
Return value
string The key.
1 call to FieldValueExtension::getParentObjectKey()
- FieldValueExtension::getTargetEntity in src/
Twig/ Extension/ FieldValueExtension.php - Twig filter callback: Return the referenced entity.
File
- src/
Twig/ Extension/ FieldValueExtension.php, line 178
Class
- FieldValueExtension
- Provides field value filters for Twig templates.
Namespace
Drupal\twig_field_value\Twig\ExtensionCode
private function getParentObjectKey(array $build) {
$options = [
'#object',
'#field_collection_item',
];
$parent_key = '';
foreach ($options as $option) {
if (isset($build[$option])) {
$parent_key = $option;
break;
}
}
return $parent_key;
}