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

Helper function to remove empty IPTC keywords.

Parameters

array $data: List of keywords.

Return value

array List of keywords.

1 call to ExifPHPExtension::removeEmptyIptcKeywords()
ExifPHPExtension::readIptcTags in src/ExifPHPExtension.php
Read IPTC Information from a file.

File

src/ExifPHPExtension.php, line 339

Class

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

Namespace

Drupal\exif

Code

private function removeEmptyIptcKeywords(array $data) {
    if (!in_array('', $data, TRUE)) {
        return $data;
    }
    foreach ($data as $key => $value) {
        if (empty($value)) {
            unset($data[$key]);
        }
    }
    return $data;
}