Skip to content
Snippets Groups Projects
Commit a041b050 authored by xiaohua guan's avatar xiaohua guan Committed by Yas Naoi
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 7bc16bb1
Branches 8.x-2.x
Tags 8.x-2.1
No related merge requests found
......@@ -583,8 +583,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)) {
......
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