Linked Questions

1 vote
1 answer

Custom POST request [duplicate]

I am very new to Drupal. My project requires me to create a custom module. I am working with Headless Drupal and I want to make a POST request. I cannot pass the POSTMAN Body to my Request argument in ...
Suchismita Banerjee's user avatar
14 votes
3 answers

How do I retrieve the query parameters from a path? [duplicate]

How do I retrieve the query parameters from a path. Here's my path: /search?keys=hello Here is what I've tried: $test1 = \Drupal::request()->request->get('name'); $test2 = \Drupal::request()-&...
dbj44's user avatar
  • 4,754
9 votes
4 answers

How do you receive JSON data in a controller?

I'm using AngularJS one of my module's settings page, so I have a javascript object in client side as a model. This is the model I assembled with Angular. var model = { title: 'This is a title', ...
Peter Hurtony's user avatar
4 votes
1 answer

How can I retrieve the query parameters passed from the URL?

In Drupal 8, $_GET does not return the query parameter I am expecting to get. With the following code, I get 1 all the times, even when I expect to get 2. namespace Drupal\newday\Controller; use ...
3 votes
2 answers

How can I retrieve information about the current request's URL?

I need help finding a way to get the current request URL in a controller and, based on that, change the webform name in the controller. My code: '#url' => Url::fromRoute('entity.webform.canonical',[...
Thkr's user avatar
  • 143
1 vote
2 answers

Drupal::request()->request->all() returns an empty array

I have a custom controller that expects POST data. I had it working fine in 8.1.0 retrieving the data using \Drupal::request()->request->all() and \Drupal::request()->request->get($myvar). ...
baisong's user avatar
  • 119
0 votes
1 answer

How do I handle an incoming POST request in a module?

I am really new to Drupal but I have to do a project using it and I was just wondering how to handle an incoming POST request in a module: I am creating a module that will get incoming data from a ...
T Kharel's user avatar
1 vote
2 answers

Hide Admin Toolbar in iFrame

Is it somehow possible within Drupal 8 to hide the Admin Toolbar when the site is loaded within an iFrame? Like e.g. passing an argument? :-) I thought about using some sort of preprocess on the page ...
Sebastian's user avatar
  • 635
1 vote
2 answers

What is best practice for passing routing parameters?

In submitForm() I want to redirect to a controller and pass the form values. The form values are all arrays, btw. Here is submitForm. public function submitForm(array &$form, FormStateInterface $...
Dorian Winterfeld's user avatar
0 votes
1 answer

How to get form values in URL as keys of an array

I have a custom form with min and max price value: $form['price']['min'] = [ '#type' => 'hidden', '#default_value' => isset($_GET['price']['min']) ? $_GET['price']['min'...
user71007's user avatar