private function UnusedModulesCommands::showProjects in Unused Modules 8
Drush callback.
Prints a table with orphaned projects.
Parameters
string $op: Either 'all' or 'disabled'.
Return value
\Consolidation\OutputFormatters\StructuredData\RowsOfFields Rows with unused project information.
1 call to UnusedModulesCommands::showProjects()
- UnusedModulesCommands::modules in src/
Commands/ UnusedModulesCommands.php - Show unused modules or projects.
File
- src/
Commands/ UnusedModulesCommands.php, line 112
Class
- UnusedModulesCommands
- A Drush commandfile.
Namespace
Drupal\unused_modules\CommandsCode
private function showProjects($op = 'all') {
$modules = $this->unusedModulesHelper
->getModulesByProject();
$rows = [];
foreach ($modules as $module) {
if ($op == 'all') {
$rows[$module->projectName] = [
'project' => $module->projectName,
'has_modules' => $module->projectHasEnabledModules ? dt("Yes") : dt("No"),
'path' => $module->projectPath,
];
}
elseif ($op == 'disabled') {
if (!$module->projectHasEnabledModules) {
$rows[$module->projectName] = [
'project' => $module->projectName,
'has_modules' => $module->projectHasEnabledModules ? dt("Yes") : dt("No"),
'path' => $module->projectPath,
];
}
}
}
if (!count($rows)) {
$this
->output()
->writeln("Hurray, no orphaned projects!");
return NULL;
}
return new RowsOfFields($rows);
}