You are here

function farm_asset_archive_action in farmOS 7

Action function for farm_asset_archive_action.

Archives an asset.

Parameters

FarmAsset $asset: The asset entity object.

array $context: Array with parameters for this action.

File

modules/farm/farm_asset/farm_asset.module, line 411
Farm asset - A farm asset entity type.

Code

function farm_asset_archive_action(FarmAsset $asset, $context = array()) {

  // Only proceed if the asset is not already archived.
  if (!empty($asset->archived)) {
    return;
  }

  // Archive the asset.
  $asset->archived = REQUEST_TIME;

  // Save the asset.
  farm_asset_save($asset);
}