You are here

public static function FlexibleGroupContentVisibilityUpdate::updateVisibilityFinishedCallback in Open Social 8.7

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_group/modules/social_group_flexible_group/src/FlexibleGroupContentVisibilityUpdate.php \Drupal\social_group_flexible_group\FlexibleGroupContentVisibilityUpdate::updateVisibilityFinishedCallback()
  2. 8.6 modules/social_features/social_group/modules/social_group_flexible_group/src/FlexibleGroupContentVisibilityUpdate.php \Drupal\social_group_flexible_group\FlexibleGroupContentVisibilityUpdate::updateVisibilityFinishedCallback()
  3. 8.8 modules/social_features/social_group/modules/social_group_flexible_group/src/FlexibleGroupContentVisibilityUpdate.php \Drupal\social_group_flexible_group\FlexibleGroupContentVisibilityUpdate::updateVisibilityFinishedCallback()
  4. 10.3.x modules/social_features/social_group/modules/social_group_flexible_group/src/FlexibleGroupContentVisibilityUpdate.php \Drupal\social_group_flexible_group\FlexibleGroupContentVisibilityUpdate::updateVisibilityFinishedCallback()
  5. 10.0.x modules/social_features/social_group/modules/social_group_flexible_group/src/FlexibleGroupContentVisibilityUpdate.php \Drupal\social_group_flexible_group\FlexibleGroupContentVisibilityUpdate::updateVisibilityFinishedCallback()
  6. 10.1.x modules/social_features/social_group/modules/social_group_flexible_group/src/FlexibleGroupContentVisibilityUpdate.php \Drupal\social_group_flexible_group\FlexibleGroupContentVisibilityUpdate::updateVisibilityFinishedCallback()
  7. 10.2.x modules/social_features/social_group/modules/social_group_flexible_group/src/FlexibleGroupContentVisibilityUpdate.php \Drupal\social_group_flexible_group\FlexibleGroupContentVisibilityUpdate::updateVisibilityFinishedCallback()

Callback for finished batch events.

Parameters

bool $success: TRUE if the update was fully succeeded.

array $results: Contains individual results per operation.

array $operations: Contains the unprocessed operations that failed or weren't touched yet.

File

modules/social_features/social_group/modules/social_group_flexible_group/src/FlexibleGroupContentVisibilityUpdate.php, line 151

Class

FlexibleGroupContentVisibilityUpdate
Class FlexibleGroupContentVisibilityUpdate.

Namespace

Drupal\social_group_flexible_group

Code

public static function updateVisibilityFinishedCallback($success, array $results, array $operations) {
  $messenger = \Drupal::messenger();
  if ($success) {

    // Here we could do something meaningful with the results.
    // We just display the number of nodes we processed...
    $messenger
      ->addStatus(t('Visibility of content item(s) updated.'));
  }
  else {

    // An error occurred.
    // $operations contains the operations that remained unprocessed.
    $error_operation = reset($operations);
    $messenger
      ->addError(t('An error occurred while processing @operation with arguments : @args', [
      '@operation' => $error_operation[0],
      '@args' => print_r($error_operation[0], TRUE),
    ]));
  }
}