You are here

protected function AcquiaDAM_Assets_AbstractAsset::ensureIsValidAssetId in Media: Acquia DAM 7

Make sure the given ID is valid to be used as an asset ID.

Parameters

int $id: The ID to check.

Return value

int|false Returns the asset ID or FALSE on failure.

2 calls to AcquiaDAM_Assets_AbstractAsset::ensureIsValidAssetId()
AcquiaDAM_Assets_AbstractAsset::getMultiple in src/AcquiaDAM/AcquiaDAM_Assets_AbstractAsset.inc
Get multiple assets at once.
AcquiaDAM_Assets_AbstractAsset::setId in src/AcquiaDAM/AcquiaDAM_Assets_AbstractAsset.inc
Set the asset ID for the current asset.

File

src/AcquiaDAM/AcquiaDAM_Assets_AbstractAsset.inc, line 120

Class

AcquiaDAM_Assets_AbstractAsset
Abstract class base for Acquia DAM assets.

Code

protected function ensureIsValidAssetId($id) {
  $id = filter_var($id, FILTER_VALIDATE_INT, [
    'options' => [
      'default' => 0,
      'min_range' => 1,
    ],
  ]);
  return $id;
}