You are here

protected function Font::doGetMetadata in File metadata manager 8

Same name and namespace in other branches
  1. 8.2 file_mdm_font/src/Plugin/FileMetadata/Font.php \Drupal\file_mdm_font\Plugin\FileMetadata\Font::doGetMetadata()

Gets a metadata element.

Parameters

mixed|null $key: A key to determine the metadata element to be returned. If NULL, the entire metadata will be returned.

Return value

mixed|null The value of the element specified by $key. If $key is NULL, the entire metadata. If no metadata is available, return NULL.

Overrides FileMetadataPluginBase::doGetMetadata

File

file_mdm_font/src/Plugin/FileMetadata/Font.php, line 85

Class

Font
FileMetadata plugin for TTF/OTF/WOFF font information.

Namespace

Drupal\file_mdm_font\Plugin\FileMetadata

Code

protected function doGetMetadata($key = NULL) {
  if ($key === NULL) {
    return $this->metadata;
  }
  else {
    $this
      ->validateKey($key, __FUNCTION__);
    $l_key = strtolower($key);
    if (in_array($l_key, array_map('strtolower', $this
      ->getSupportedKeys()), TRUE)) {
      return isset($this->metadata[$l_key]) ? $this->metadata[$l_key] : NULL;
    }
    return NULL;
  }
}