D8 PHP filter ~ use of $_GET and $_POST

by Michelle Bradley   Last Updated January 12, 2018 04:07 AM

I just installed a new Drupal 8. I have php scripts that use the php filter (I don't need the lecture..) and I need to move these to D8. I am trying to find the silver bullet to make $_POST and $_GET work. I have tried:

      $mode = \Drupal::request()->query->get('mode');

that does not work for something like localhost/pagename?mode=12345

If I am using the Basic Page (add content) and select the PHP filter, how exactly do I get back the values passed that would be retrieved by $_GET and $_POST in D7?

For example, how would I achieve:

     $this = $_GET['this'];
     $that = $_POST['that'];

using Drupal 8's PHP filter in the [Add Content] functionality?


Tags : 8 input-formats

Related Questions

What are the benefits of it?

Updated April 20, 2015 09:03 AM

Change the input format for 3000+ nodes

Updated June 12, 2015 12:03 PM