public function LicenseFileManagerInterface::getActiveLicenses in Commerce File 8.2
Returns active licenses for the given file and the given user, optionally restricted to licenses referencing the given purchasable entity.
A file could be sold from multiple products. The user's active licenses for all of them are loaded, and the first eligible one is returned.
Parameters
\Drupal\file\FileInterface $file: The file.
\Drupal\Core\Session\AccountInterface|null $account: The account to check for. If null, the current user is used instead.
\Drupal\commerce\PurchasableEntityInterface|null $purchasable_entity: (optional) The purchasable entity.
Return value
\Drupal\commerce_license\Entity\LicenseInterface[] The active licenses for the given file if found, an empty array otherwise.
1 method overrides LicenseFileManagerInterface::getActiveLicenses()
- LicenseFileManager::getActiveLicenses in src/
LicenseFileManager.php - Returns active licenses for the given file and the given user, optionally restricted to licenses referencing the given purchasable entity.
File
- src/
LicenseFileManagerInterface.php, line 49
Class
Namespace
Drupal\commerce_fileCode
public function getActiveLicenses(FileInterface $file, AccountInterface $account = NULL, PurchasableEntityInterface $purchasable_entity = NULL);