Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
2
votes
Accepted
module controller does not respond!
You forgot requirements (which is required):
my_module.agreement:
path: 'my_module/send_consent'
defaults:
_controller: '\Drupal\my_module\Controller\MyModuleController::check_agreement'
…
4
votes
Accepted
PHP constructor property promotion: how to call the parent constructor?
You can't "eliminate" the arguments for the parent, they need to remain in the constructor. It's only the argument that is for your class specifically that you can use property promotion on.
For examp …
94
votes
Accepted
How to get $_POST and $_GET parameters
From the change record:
$name = $_POST['name']; // form param
becomes
$name = \Drupal::request()->request->get('name'); // form param
Incidentally, for GET vars, you would use:
$query = \Drupal …
0
votes
Accepted
Get variable from controller in twig using template
I’m not sure why you’re expecting test to be an object, you declared it as a string.
Assuming the value of “2017” from your example is what you’re trying to get the variable is just:
{{ test }}
2
votes
Accepted
How can I delete a file served by a custom controller after it has been downloaded?
You're looking for BinaryFileResponse::deleteFileAfterSend:
$response = new BinaryFileResponse($temporary_pdf_file, 200, $headers, TRUE);
return $response->deleteFileAfterSend(TRUE);
4
votes
Accepted
How to render a custom entity in a controller?
Controllers should return a render array (or a custom response), you almost never need to render anything yourself outside a template.
Just replace this:
$build = $view_builder->view($entity);
$rend …
0
votes
How to change payment state programmatically?
Load up the payments:
$payments = \Drupal\commerce_order\Payment\Payment::loadByProperties(['order_id' => $order->id()]);
Then loop through and save what you want to:
foreach ($payments as $paymen …