You are here

private function ExifContent::getImageFields in Exif 8.2

Same name and namespace in other branches
  1. 8 src/ExifContent.php \Drupal\exif\ExifContent::getImageFields()

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 272

Class

ExifContent
Class ExifContent make link between drupal content and file content.

Namespace

Drupal\exif

Code

private function getImageFields(FieldableEntityInterface $entity) {
  $result = [];
  if ($entity
    ->getEntityTypeId() == 'node' or $entity
    ->getEntityTypeId() == 'media' || $entity
    ->getEntityTypeId() == 'photos_image') {
    foreach ($entity
      ->getFieldDefinitions() as $fieldName => $fieldDefinition) {
      if ($fieldDefinition
        ->getType() == 'image') {
        $result[$fieldName] = $fieldDefinition;
      }
    }
  }
  if ($entity
    ->getEntityTypeId() == 'file') {
    $result['file'] = $entity;
  }
  return $result;
}