Skip to content
Snippets Groups Projects
Commit 02b0e771 authored by Lavanya Talwar's avatar Lavanya Talwar Committed by Chris Wells
Browse files

Issue #3495318: Remove the ability for the project_browser.browse route to take a project ID

parent ea54f920
No related branches found
No related tags found
No related merge requests found
......@@ -13,3 +13,5 @@ NOCHANGES
CURLOPT
RETURNTRANSFER
varchar
techdebt
......@@ -19,11 +19,10 @@ project_browser.api_project_get_all:
#options:
# no_cache: 'TRUE'
project_browser.browse:
path: '/admin/modules/browse/{source}/{id}'
path: '/admin/modules/browse/{source}'
defaults:
_controller: '\Drupal\project_browser\Controller\BrowserController::browse'
_title: 'Browse projects'
id: null
requirements:
_permission: 'administer modules'
project_browser.settings:
......
......@@ -26,18 +26,14 @@ class BrowserController extends ControllerBase {
*
* @param string $source
* The ID of the source plugin to query for projects.
* @param string|null $id
* If viewing a specific project, the project's local ID (as known to the
* source plugin).
*
* @return array
* A render array.
*/
public function browse(string $source, ?string $id): array {
public function browse(string $source): array {
return [
'#type' => 'project_browser',
'#source' => $source,
'#id' => $id,
];
}
......
......@@ -97,8 +97,7 @@ final class ProjectBrowser implements ElementInterface, ContainerFactoryPluginIn
*/
public function attachProjectBrowserSettings(array $element): array {
$element['#attached']['drupalSettings']['project_browser'] = $this->getDrupalSettings(
$element['#source'],
$element['#id'] ?? NULL
$element['#source']
);
return $element;
}
......@@ -108,14 +107,11 @@ final class ProjectBrowser implements ElementInterface, ContainerFactoryPluginIn
*
* @param string $source
* The ID of the source plugin to query for projects.
* @param string|null $id
* If viewing a specific project, the project's local ID (as known to the
* source plugin).
*
* @return array
* An array of Drupal settings.
*/
private function getDrupalSettings(string $source, ?string $id): array {
private function getDrupalSettings(string $source): array {
$current_sources = [
$source => $this->enabledSourceHandler->getCurrentSources()[$source],
];
......@@ -126,13 +122,11 @@ final class ProjectBrowser implements ElementInterface, ContainerFactoryPluginIn
'warnings' => [],
'status_checked' => FALSE,
];
if (empty($id)) {
// @todo Fix https://www.drupal.org/node/3497624 to avoid adding
// hard-coded values. #techdebt
if ($source !== 'recipes' && $package_manager['available']) {
$package_manager = array_merge($package_manager, $this->installReadiness->validatePackageManager());
$package_manager['status_checked'] = TRUE;
}
// @todo Fix https://www.drupal.org/node/3497624 to avoid adding
// hard-coded values. #techdebt
if ($source !== 'recipes' && $package_manager['available']) {
$package_manager = array_merge($package_manager, $this->installReadiness->validatePackageManager());
$package_manager['status_checked'] = TRUE;
}
return [
......
......@@ -49,7 +49,6 @@ final class LocalTaskDeriver extends DeriverBase implements ContainerDeriverInte
$source_id = $source->getPluginId();
$local_task['route_parameters'] = [
'source' => $source_id,
'id' => NULL,
];
$derivative_id = str_replace($source::DERIVATIVE_SEPARATOR, '__', $source_id);
$this->derivatives[$derivative_id] = $local_task;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment