You are here

public function UpgradeRectorForm::submitRector in Upgrade Rector 8

Form submission handler.

Parameters

\Drupal\Core\Extension\Extension $extension: Selected extension.

2 calls to UpgradeRectorForm::submitRector()
UpgradeRectorForm::submitContribRector in src/Form/UpgradeRectorForm.php
Form submission handler.
UpgradeRectorForm::submitCustomRector in src/Form/UpgradeRectorForm.php
Form submission handler.

File

src/Form/UpgradeRectorForm.php, line 198

Class

UpgradeRectorForm

Namespace

Drupal\upgrade_rector\Form

Code

public function submitRector(Extension $extension) {
  $info = $extension->info;
  $label = $info['name'] . (!empty($info['version']) ? ' ' . $info['version'] : '');
  if (\Drupal::service('upgrade_rector.rector_processor')
    ->runRector($extension)) {
    $this
      ->messenger()
      ->addMessage($this
      ->t('Parsing @project was successful.', [
      '@project' => $label,
    ]));
  }
  else {
    $this
      ->messenger()
      ->addError($this
      ->t('Error while parsing @project.', [
      '@project' => $label,
    ]));
  }
}