Same name and namespace in other branches
- 8.x-2.x src/ExifContent.php \Drupal\exif\ExifContent::getImageFields() 1 comment
Look for image fields in an entity type.
Parameters
\Drupal\Core\Entity\FieldableEntityInterface $entity: The entity to look for image fields.
Return value
array the list of image fields found in the entity
1 call to ExifContent::getImageFields()
- ExifContent::entity_insert_update in src/
ExifContent.php - Main entry of the module.
File
-
src/
ExifContent.php, line 269
Class
- ExifContent
- Class ExifContent make link between drupal content and file content.
Namespace
Drupal\exifCode
private function getImageFields(FieldableEntityInterface $entity) {
$result = [];
if ($entity->getEntityTypeId() == 'node' or $entity->getEntityTypeId() == 'media') {
foreach ($entity->getFieldDefinitions() as $fieldName => $fieldDefinition) {
if (in_array($fieldDefinition->getType(), [
'image',
'file',
])) {
$result[$fieldName] = $fieldDefinition;
}
}
}
if ($entity->getEntityTypeId() == 'file') {
$result['file'] = $entity;
}
return $result;
}