public static function Asset::load in Mini site 8
Load asset by id.
Parameters
int $id: Asset id.
Return value
\Drupal\minisite\Asset|null Class instance or NULL if asset cannot be loaded.
Overrides AssetInterface::load
3 calls to Asset::load()
- AliasController::deliverAsset in src/
Controller/ AliasController.php - Request callback to deliver a single minisite asset.
- AssetTest::testAssetInstance in tests/
src/ Functional/ AssetTest.php - Test working with Asset class instance.
- AssetTest::testSaveLong in tests/
src/ Functional/ AssetTest.php - Test Asset::save().
File
- src/
Asset.php, line 180
Class
- Asset
- Class Asset.
Namespace
Drupal\minisiteCode
public static function load($id) {
$values = Database::getConnection()
->select('minisite_asset', 'ma')
->fields('ma')
->condition('id', $id)
->orderBy('id', 'DESC')
->execute()
->fetchAssoc();
if (empty($values)) {
return NULL;
}
return self::fromValues($values);
}