You are here

public function Asset::__construct in Mini site 8

Asset constructor.

Parameters

string $entity_type: The parent entity type.

string $entity_bundle: The parent entity bundle.

int $entity_id: The parent entity id.

string $entity_language: The parent entity language.

string $field_name: The field name.

string $file_uri: The URI of the file that this asset represents.

string $file_mime: (optional) File MIME. If not provided - will be discovered automatically.

int $file_size: (optional) File size. If not provided - will be discovered automatically.

File

src/Asset.php, line 111

Class

Asset
Class Asset.

Namespace

Drupal\minisite

Code

public function __construct($entity_type, $entity_bundle, $entity_id, $entity_language, $field_name, $file_uri, $file_mime = NULL, $file_size = NULL) {
  $this->entityType = $entity_type;
  $this->entityBundle = $entity_bundle;
  $this->entityId = $entity_id;
  $this->entityLanguage = $entity_language;
  $this->fieldName = $field_name;

  // Create a bag of all URLs relevant to this asset.
  $this->urlBag = new UrlBag($file_uri);
  $this
    ->setMimeType($file_mime);
  $this
    ->setSize($file_size);
}