Link Vault for Craft CMS - Hooks

Below are Link Vault's hooks that are available to plugin developers.

linkVaultDownloadStart

This hook allows a plugin developer to manipulate the download record attributes prior to their parsing and serving of the download file. The array of attributes is passed by reference.

Sample Code

// Example
public function linkVaultDownloadStart($attrs)
{
    $attrs['someCustomField'] = craft()->httpSession->get('someSessionItem');
    if ( craft()->customPlugin->currentUserDownloads() > 100 ) {
        craft()->request->redirect( $this->limitUrl );
    }
}

linkVaultDownloadEnd

This hook allows a plugin developer to manipulate the download record attributes after the file has been served and before the download has been logged. This hook is only called for files that are stored on the web server. The array of attributes is passed by reference.

Sample Code

// Example
public function linkVaultDownloadEnd($attrs)
{
    $attrs['someCustomField'] = craft()->httpSession->get('someSessionItem');
}