You are here

protected function ExifTagMapper::getSupportedKeysMap in File metadata manager 8.2

Same name and namespace in other branches
  1. 8 file_mdm_exif/src/ExifTagMapper.php \Drupal\file_mdm_exif\ExifTagMapper::getSupportedKeysMap()

Returns the list of supported metadata 'keys'.

Builds and caches the list as needed.

Return value

array A simple array of IFD/TAG combinations, expressed as literals.

1 call to ExifTagMapper::getSupportedKeysMap()
ExifTagMapper::getSupportedKeys in file_mdm_exif/src/ExifTagMapper.php
Returns a list of default metadata 'keys' supported.

File

file_mdm_exif/src/ExifTagMapper.php, line 189

Class

ExifTagMapper
Provides a mapping service for EXIF ifds and tags.

Namespace

Drupal\file_mdm_exif

Code

protected function getSupportedKeysMap() {
  if (!$this->supportedKeysMap) {
    $cache_id = 'supportedKeys';
    if ($cache = $this
      ->getCache($cache_id)) {
      $this->supportedKeysMap = $cache->data;
    }
    else {
      $this->supportedKeysMap = [];
      foreach ($this
        ->getSupportedIfdsMap() as $ifd) {
        $ifd_obj = new PelIfd($ifd[1]);
        $valid_tags = $ifd_obj
          ->getValidTags();
        foreach ($valid_tags as $tag) {
          $this->supportedKeysMap[] = [
            $ifd[0],
            PelTag::getName($ifd[1], $tag),
          ];
        }
      }
      $this
        ->setCache($cache_id, $this->supportedKeysMap);
    }
  }
  return $this->supportedKeysMap;
}