class FileReferenceUsage
Provides information which field on a given entity uses a file.
Hierarchy
- class \Drupal\file\FileReferenceUsage
Expanded class hierarchy of FileReferenceUsage
See also
\Drupal\file\FileReferenceResolver::loadEntityFromUsage()
File
-
core/
modules/ file/ src/ FileReferenceUsage.php, line 12
Namespace
Drupal\fileView source
readonly class FileReferenceUsage {
/**
* Constructs a FileReferenceUsage object.
*
* @param string $entityTypeId
* The entity type.
* @param string $fieldName
* The name of the field that contains the reference.
* @param string|int|null $id
* The entity ID.
* @param int|string|null $revisionId
* The revision ID.
*/
public function __construct(public string $entityTypeId, public string $fieldName, public int|string|null $id = NULL, public int|string|null $revisionId = NULL) {
if (is_null($id) && is_null($revisionId)) {
throw new \InvalidArgumentException('$id and $revisionId cannot both be null.');
}
}
}
Members
| Title Sort descending | Modifiers | Object type | Summary |
|---|---|---|---|
| FileReferenceUsage::__construct | public | function | Constructs a FileReferenceUsage object. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.