Same name and namespace in other branches
  1. 8.x-1.x src/ExifPHPExtension.php \Drupal\exif\ExifPHPExtension::getMetadataFields()
  2. 8.x-2.x src/ExifPHPExtension.php \Drupal\exif\ExifPHPExtension::getMetadataFields()

Work out which fields have to be processed.

Going through all the fields that have been created for a given node type and try to figure out which match the naming convention -> so that we know which exif information we have to read

Naming convention are: field_exif_xxx (xxx would be the name of the exif tag to read.

Parameters

array $fields: The fields.

Return value

array A list of EXIF tags to read for this image.

Overrides ExifInterface::getMetadataFields

File

./ExifPHPExtension.php, line 48

Class

ExifPHPExtension
This is a helper class to handle the whole data processing of exif.

Namespace

Drupal\exif

Code

public function getMetadataFields(array $fields = array()) {
    $arSections = self::getMetadataSections();
    foreach ($fields as $drupal_field => $metadata_settings) {
        $metadata_field = $metadata_settings['metadata_field'];
        $ar = explode("_", $metadata_field);
        if (isset($ar[0]) && in_array($ar[0], $arSections)) {
            $section = $ar[0];
            unset($ar[0]);
            $fields[$drupal_field]['metadata_field'] = array(
                'section' => $section,
                'tag' => implode("_", $ar),
            );
        }
        else {
            // Remove from the list a non usable description.
            unset($fields[$drupal_field]);
            watchdog('exif', 'Not able to understand exif field settings !field', array(
                '!field' => $metadata_field,
            ), WATCHDOG_WARNING);
        }
    }
    return $fields;
}