You are here

public function FileMetadataPluginBase::setHash in File metadata manager 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/FileMetadata/FileMetadataPluginBase.php \Drupal\file_mdm\Plugin\FileMetadata\FileMetadataPluginBase::setHash()

Sets the hash used to reference the URI by the metadata manager.

Parameters

string $hash: A hash string.

Return value

$this

Throws

\Drupal\file_mdm\FileMetadataException If no hash is specified.

Overrides FileMetadataPluginInterface::setHash

File

src/Plugin/FileMetadata/FileMetadataPluginBase.php, line 238

Class

FileMetadataPluginBase
Abstract implementation of a base File Metadata plugin.

Namespace

Drupal\file_mdm\Plugin\FileMetadata

Code

public function setHash($hash) {
  if (!$hash) {
    throw new FileMetadataException('Missing $hash argument', $this
      ->getPluginId(), __FUNCTION__);
  }
  $this->hash = $hash;
  return $this;
}