private function UpgradeRectorForm::buildProjectList in Upgrade Rector 8
Builds a list and status summary of projects.
Parameters
\Drupal\Core\Extension\Extension[] $projects: Array of extensions representing projects.
string $category: One of 'custom' or 'contrib'. Presenting messages may be different for each.
Return value
array Build array.
1 call to UpgradeRectorForm::buildProjectList()
- UpgradeRectorForm::buildForm in src/
Form/ UpgradeRectorForm.php - Form constructor.
File
- src/
Form/ UpgradeRectorForm.php, line 137
Class
Namespace
Drupal\upgrade_rector\FormCode
private function buildProjectList(array $projects, string $category) {
$list = $form = [];
foreach ($projects as $name => $extension) {
$info = $extension->info;
$label = $info['name'] . (!empty($info['version']) ? ' ' . $info['version'] : '');
$list[$name] = $label;
if ($results = $this->rectorResults
->get($extension
->getName())) {
$form[$name] = $this->rectorProcessor
->formatResults($results, $extension, $category) + [
'#type' => 'details',
'#closed' => TRUE,
];
}
}
$form['project'] = [
'#type' => 'select',
'#title' => $this
->t('Select project'),
'#options' => $list,
];
$form['submit'] = [
'#type' => 'submit',
'#name' => 'rector_' . $category,
'#value' => $this
->t('Run rector'),
'#button_type' => 'primary',
'#submit' => [
[
$this,
'submit' . ucfirst($category) . 'Rector',
],
],
];
return $form;
}