class AcquiaDAM_Assets_Asset in Media: Acquia DAM 7
Generic Acquia DAM assets.
@package AcquiaDAM
Hierarchy
- class \AcquiaDAM_Assets_AbstractAsset implements \ArrayAccess, \JsonSerializable
- class \AcquiaDAM_Assets_Asset
 
 
Expanded class hierarchy of AcquiaDAM_Assets_Asset
File
- src/
AcquiaDAM/ AcquiaDAM_Assets_Asset.inc, line 8  
View source
class AcquiaDAM_Assets_Asset extends AcquiaDAM_Assets_AbstractAsset {
  /**
   * Return the API endpoint base.
   *
   * {@inheritDoc}
   *
   * @return string
   *   The base slug to use in API requests.
   */
  protected function getEndpointBase() {
    return 'assets';
  }
  /**
   * Get the asset type identifier.
   *
   * {@inheritDoc}
   *
   * @return string
   *   The asset type machine name.
   */
  public function getType() {
    return 'asset';
  }
  /**
   * Get metadata for the asset.
   *
   * @param string $type
   *   The metadata type to return: exif, xmp.
   *
   * @return array
   *   The metadata request response.
   */
  protected function getMetadata($type = 'exif') {
    $this
      ->requireId();
    return $this
      ->request(sprintf('%s/%d/metadatas/%s', $this
      ->getEndpointBase(), $this->assetId, $type));
  }
  /**
   * Get XMP metadata for the asset.
   *
   * @return array
   *   The metadata request response.
   *
   * @see AcquiaDAM_Assets_Asset::getMetadata()
   */
  public function getXMP() {
    return $this
      ->getMetadata('xmp');
  }
  /**
   * Get EXIF metadata for the asset.
   *
   * @return array
   *   The metadata request response.
   *
   * @see AcquiaDAM_Assets_Asset::getMetadata()
   */
  public function getEXIF() {
    return $this
      ->getMetadata('exif');
  }
  /**
   * Get the asset download URL.
   *
   * @param array $options
   *   An array of options to pass to the API call.
   *
   * @return array|false
   *   The request response or FALSE on failure.
   */
  public function getDownload(array $options = []) {
    $this
      ->requireId();
    $options += [
      'sendNotificationsOff' => TRUE,
      'trackDownloadsOff' => TRUE,
      'geturl' => FALSE,
    ];
    return $this
      ->request(sprintf('%s/%d/download', $this
      ->getEndpointBase(), $this->asset['id']), $options);
  }
  /**
   * Get the asset download URL.
   *
   * @return string|false
   *   The asset download URL or FALSE on failure.
   */
  public function getDownloadUrl() {
    $result = $this
      ->getDownload([
      'geturl' => TRUE,
    ]);
    return empty($result['url']) ? FALSE : $result['url'];
  }
}Members
| 
            Name | 
                  Modifiers | Type | Description | Overrides | 
|---|---|---|---|---|
| 
            AcquiaDAM_Assets_AbstractAsset:: | 
                  protected | property | Asset information as returned by the API. | |
| 
            AcquiaDAM_Assets_AbstractAsset:: | 
                  protected | property | The asset ID. | |
| 
            AcquiaDAM_Assets_AbstractAsset:: | 
                  protected | property | A list of class dependencies. | |
| 
            AcquiaDAM_Assets_AbstractAsset:: | 
                  protected | function | Make sure the given ID is valid to be used as an asset ID. | |
| 
            AcquiaDAM_Assets_AbstractAsset:: | 
                  public | function | Fetch the asset from the API. | |
| 
            AcquiaDAM_Assets_AbstractAsset:: | 
                  protected | function | Gets the client object for use. | |
| 
            AcquiaDAM_Assets_AbstractAsset:: | 
                  public | function | Gets the path to this asset within the DAM web interface. | 1 | 
| 
            AcquiaDAM_Assets_AbstractAsset:: | 
                  public | function | Gets the URL to the asset within the DAM provider. | |
| 
            AcquiaDAM_Assets_AbstractAsset:: | 
                  public | function | Get multiple assets at once. | |
| 
            AcquiaDAM_Assets_AbstractAsset:: | 
                  public | function | Get the URL to the DAM-provided preview if possible. | |
| 
            AcquiaDAM_Assets_AbstractAsset:: | 
                  public static | function | Get a list of possible pregenerated thumbnail sizes. | |
| 
            AcquiaDAM_Assets_AbstractAsset:: | 
                  public | function | Get the URL to the DAM-provided thumbnail if possible. | |
| 
            AcquiaDAM_Assets_AbstractAsset:: | 
                  public | function | Checks if the current asset is expired. | |
| 
            AcquiaDAM_Assets_AbstractAsset:: | 
                  public | function | Implementation for JsonSerializable. | |
| 
            AcquiaDAM_Assets_AbstractAsset:: | 
                  public | function | Implementation for ArrayAccess. | |
| 
            AcquiaDAM_Assets_AbstractAsset:: | 
                  public | function | Implementation for ArrayAccess. | |
| 
            AcquiaDAM_Assets_AbstractAsset:: | 
                  public | function | Implementation for ArrayAccess. | |
| 
            AcquiaDAM_Assets_AbstractAsset:: | 
                  public | function | Implementation for ArrayAccess. | |
| 
            AcquiaDAM_Assets_AbstractAsset:: | 
                  protected | function | Client request wrapper. | |
| 
            AcquiaDAM_Assets_AbstractAsset:: | 
                  protected | function | Ensure we have an asset ID set. | |
| 
            AcquiaDAM_Assets_AbstractAsset:: | 
                  public | function | Set the asset ID for the current asset. | |
| 
            AcquiaDAM_Assets_AbstractAsset:: | 
                  public | function | Get an array representation of this asset. | |
| 
            AcquiaDAM_Assets_AbstractAsset:: | 
                  public | function | Create an Asset. | |
| 
            AcquiaDAM_Assets_AbstractAsset:: | 
                  public | function | Return a string representation of this asset. | |
| 
            AcquiaDAM_Assets_Asset:: | 
                  public | function | Get the asset download URL. | |
| 
            AcquiaDAM_Assets_Asset:: | 
                  public | function | Get the asset download URL. | |
| 
            AcquiaDAM_Assets_Asset:: | 
                  protected | function | 
            Return the API endpoint base. Overrides AcquiaDAM_Assets_AbstractAsset:: | 
                  |
| 
            AcquiaDAM_Assets_Asset:: | 
                  public | function | Get EXIF metadata for the asset. | |
| 
            AcquiaDAM_Assets_Asset:: | 
                  protected | function | Get metadata for the asset. | |
| 
            AcquiaDAM_Assets_Asset:: | 
                  public | function | 
            Get the asset type identifier. Overrides AcquiaDAM_Assets_AbstractAsset:: | 
                  |
| 
            AcquiaDAM_Assets_Asset:: | 
                  public | function | Get XMP metadata for the asset. |