You are here

protected function FeaturesGenerationWrite::failure in Features 8.3

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

Registers a failed package or profile write 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 FeaturesGenerationWrite::failure()
FeaturesGenerationWrite::generatePackage in src/Plugin/FeaturesGeneration/FeaturesGenerationWrite.php
Writes a package or profile's files to the file system.

File

src/Plugin/FeaturesGeneration/FeaturesGenerationWrite.php, line 196

Class

FeaturesGenerationWrite
Class for writing packages to the local file system.

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,
    'display' => TRUE,
    'message' => '@type @package not written to @directory. Error: @error.',
    'variables' => [
      '@type' => $type,
      '@package' => $package
        ->getName(),
      '@directory' => $package
        ->getDirectory(),
      '@error' => isset($exception) ? $exception
        ->getMessage() : $message,
    ],
  ];
}