You are here

protected function FeaturesGenerationArchive::failure in Features 8.4

Same name and namespace in other branches
  1. 8.3 src/Plugin/FeaturesGeneration/FeaturesGenerationArchive.php \Drupal\features\Plugin\FeaturesGeneration\FeaturesGenerationArchive::failure()

Registers a failed package or profile archive operation.

Parameters

array &$return: The return value, passed by reference.

\Drupal\features\Package $package: The package or profile.

\Exception $exception: The exception object.

string $message: Error message when there isn't an Exception object.

1 call to FeaturesGenerationArchive::failure()
FeaturesGenerationArchive::generatePackage in src/Plugin/FeaturesGeneration/FeaturesGenerationArchive.php
Writes a package or profile's files to an archive.

File

src/Plugin/FeaturesGeneration/FeaturesGenerationArchive.php, line 253

Class

FeaturesGenerationArchive
Class for generating a compressed archive of packages.

Namespace

Drupal\features\Plugin\FeaturesGeneration

Code

protected function failure(array &$return, Package $package, \Exception $exception = NULL, $message = '') {
  $type = $package
    ->getType() == 'module' ? $this
    ->t('Package') : $this
    ->t('Profile');
  $return[] = [
    'success' => FALSE,
    // Archive writing doesn't merit a message, and if done through the UI
    // would appear on the subsequent page load.
    'display' => FALSE,
    'message' => '@type @package not written to archive. Error: @error.',
    'variables' => [
      '@type' => $type,
      '@package' => $package
        ->getName(),
      '@error' => isset($exception) ? $exception
        ->getMessage() : $message,
    ],
  ];
}