Commit a6b181a4 authored by Xiaohua Guan's avatar Xiaohua Guan Committed by yas
Browse files

Issue #3213541 by Xiaohua Guan, yas: Remove the cloud context select form...

Issue #3213541 by Xiaohua Guan, yas: Remove the cloud context select form control displayed when I click apply button
parent 56cbb670
......@@ -548,8 +548,25 @@ function k8s_form_views_exposed_form_alter(array &$form, FormStateInterface $for
}
$route = \Drupal::routeMatch();
$cloud_context = $route->getParameter('cloud_context');
$cloud_project_id = $route->getParameter('cloud_project');
if ($route->getRouteName() === 'views.ajax') {
// When the request is from ajax, get the cloud context from referer.
global $base_url;
// Get the referer url.
$referer = \Drupal::request()->headers->get('referer');
if (!empty($referer)) {
// Get the alias or the referer.
$alias = substr($referer, strlen($base_url));
$url = Url::fromUri('internal:' . $alias);
$route_parameters = $url->getRouteParameters();
$cloud_context = $route_parameters['cloud_context'] ?? NULL;
$cloud_project_id = $route_parameters['cloud_project'] ?? NULL;
}
}
else {
$cloud_context = $route->getParameter('cloud_context');
$cloud_project_id = $route->getParameter('cloud_project');
}
$cloud_project = NULL;
$k8s_clusters = [];
if (!empty($cloud_project_id)) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment