function public static function Schemas::batchFinished

8.x-3.x Schemas.php public static Schemas::batchFinished($success, array $results, $operations)

Batch 'finished' callback.

Parameters

bool $success: A boolean indicating whether the batch has completed successfully.

array $results: The value(s) set in $context['results'] in \Drupal\bootstrap\Plugin\Setting\Update::batchProcess().

mixed $operations: If $success is FALSE, contains the operations that remained unprocessed.

Class

Schemas
The "schemas" theme setting.

Namespace

Drupal\bootstrap\Plugin\Setting

Source src/Plugin/Setting/Schemas.php (line 188)

public static function batchFinished($success, array $results, $operations) {
  /* @type \Drupal\bootstrap\Theme $theme */
  // Reconstruct the theme object this update is being applied to.
  $theme = Bootstrap::getTheme($results['theme_name']);

  // Save the current state of the installed schemas.
  $theme->setSetting('schemas', $results['schemas']);

  // Show successful updates.
  if (!empty($results['success'])) {
    $list = Element::createStandalone([
      '#theme' => 'item_list__theme_update',
      '#items' => $results['success'],
      '#context' => ['type' => 'success'],
    ]);
    Bootstrap::message(new FormattableMarkup('@message' . $list->renderPlain(), [
      '@message' => t('Successfully completed the following theme updates:'),
    ]));
  }

  // Show failed errors.
  if (!empty($results['errors'])) {
    $list = Element::createStandalone([
      '#theme' => 'item_list__theme_update',
      '#items' => $results['errors'],
      '#context' => ['type' => 'errors'],
    ]);
    Bootstrap::message(new FormattableMarkup('@message' . $list->renderPlain(), [
      '@message' => t('The following theme updates could not be completed:'),
    ]), 'error');
  }
}