protected static function Minisite::getArchiver in Mini site 8
Instantiate an archiver instance base on the file uir and name.
Parameters
string $uri: URI of the file to instantiate the archiver manager with.
string $filename: (optional) File name to pass to the archiver manager. if not provided, the filename will be extracted from the $uri.
Return value
\Drupal\Core\Archiver\ArchiverInterface The archiver instance.
2 calls to Minisite::getArchiver()
- Minisite::processArchive in src/
Minisite.php - Process archive by extracting files and filling-in assets information.
- Minisite::validateArchive in src/
Minisite.php - Validate archive.
File
- src/
Minisite.php, line 421
Class
- Minisite
- Class Minisite.
Namespace
Drupal\minisiteCode
protected static function getArchiver($uri, $filename = NULL) {
$fs = \Drupal::service('file_system');
$filename_real = $fs
->realpath($uri);
$filename = $filename ? $filename : $fs
->basename($uri);
try {
/** @var \Drupal\Core\Archiver\ArchiverInterface $archiver */
$archiver = \Drupal::getContainer()
->get('plugin.manager.minisite_archiver')
->getInstance([
'filepath' => $filename_real,
'filename' => $filename,
]);
} catch (\Exception $exception) {
return NULL;
}
return $archiver;
}