You are here

public function ExifPHPExtension::getMetadataFields in Exif 8.2

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

Return drupal fields related to this extension.

@inheritdoc

Overrides ExifInterface::getMetadataFields

File

src/ExifPHPExtension.php, line 51

Class

ExifPHPExtension
Class ExifPHPExtension Parser implementation base d on PHP Exif extension.

Namespace

Drupal\exif

Code

public function getMetadataFields(array $arCckFields = []) {
  $arSections = self::getMetadataSections();
  foreach ($arCckFields as $drupal_field => $metadata_settings) {
    $metadata_field = $metadata_settings['metadata_field'];
    $ar = explode("_", $metadata_field);
    if (isset($ar[0]) && (in_array($ar[0], $arSections) || $ar[0] == 'all')) {
      $section = $ar[0];
      unset($ar[0]);
      $arCckFields[$drupal_field]['metadata_field'] = [
        'section' => $section,
        'tag' => implode("_", $ar),
      ];
    }
    else {

      // Remove from the list a non usable description.
      unset($arCckFields[$drupal_field]);
      Drupal::logger('exif')
        ->warning(t("not able to understand exif field settings ") . $metadata_field);
    }
  }
  return $arCckFields;
}