You are here

protected function Exif::doRemoveMetadata in File metadata manager 8

Same name and namespace in other branches
  1. 8.2 file_mdm_exif/src/Plugin/FileMetadata/Exif.php \Drupal\file_mdm_exif\Plugin\FileMetadata\Exif::doRemoveMetadata()

Removes a metadata element.

Parameters

mixed $key: A key to determine the metadata element to be removed.

Return value

bool TRUE if metadata was removed successfully, FALSE otherwise.

Overrides FileMetadataPluginBase::doRemoveMetadata

File

file_mdm_exif/src/Plugin/FileMetadata/Exif.php, line 385

Class

Exif
FileMetadata plugin for EXIF.

Namespace

Drupal\file_mdm_exif\Plugin\FileMetadata

Code

protected function doRemoveMetadata($key) {
  if (!$this->metadata || !$key) {
    return FALSE;
  }
  else {
    $ifd_tag = $this->tagMapper
      ->resolveKeyToIfdAndTag($key);
    if (isset($this->metadata[$ifd_tag['ifd']][$ifd_tag['tag']])) {
      $this->metadata[$ifd_tag['ifd']][$ifd_tag['tag']] = 'deleted';
      return TRUE;
    }
    return FALSE;
  }
}