You are here

function hook_upgrade_status_operations_alter in Upgrade Status 8.2

Same name and namespace in other branches
  1. 8.3 upgrade_status.api.php \hook_upgrade_status_operations_alter()

Alter the operations run on projects on the Upgrade Status UI.

Parameters

array $operations: Batch operations array to be altered.

\Drupal\Core\Form\FormStateInterface $form_state: The submitted state of the upgrade status form.

1 invocation of hook_upgrade_status_operations_alter()
UpgradeStatusForm::submitForm in src/Form/UpgradeStatusForm.php
Form submission handler.

File

./upgrade_status.api.php, line 24
Hooks defined by Upgrade Status.

Code

function hook_upgrade_status_operations_alter(&$operations, FormStateInterface $form_state) {

  // Duplicate each operation with another one that runs rector on the
  // same extension.
  if (!empty($form_state
    ->getValue('run_rector'))) {
    $keys = array_keys($operations);
    foreach ($keys as $key) {
      $operations[] = [
        'update_rector_run_rector_batch',
        [
          $operations[$key][1][0],
        ],
      ];
    }
  }
}