You are here

public function Minisite::__construct in Mini site 8

Minisite constructor.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: Parent entity where the minisite field is located.

string $field_name: The minisite field name.

\Drupal\file\FileInterface $archive_file: The archive managed file.

string $allowed_extensions: Allowed extensions of files in archive as a space-separated string.

File

src/Minisite.php, line 106

Class

Minisite
Class Minisite.

Namespace

Drupal\minisite

Code

public function __construct(EntityInterface $entity, $field_name, FileInterface $archive_file, $allowed_extensions = MinisiteInterface::ALLOWED_EXTENSIONS) {
  $this->entityType = $entity
    ->getEntityTypeId();
  $this->entityBundle = $entity
    ->bundle();
  $this->entityId = $entity
    ->id();
  $this->entityLanguage = $entity
    ->language()
    ->getId();
  $this->fieldName = $field_name;
  $this->allowedExtensions = $allowed_extensions;
  $this
    ->setArchiveFile($archive_file);
  $this->description = '';
}