Reuse url query parameters to create new bundle

Created on 2 June 2024, 6 months ago

Problem/Motivation

I use prepopulate feature where I can prepopulate a field from the url, like :

node/add/bundle?edit[field_animal][widget][0][target_id]=15

Proposed resolution

maybe when building the form for the new entity, add the url query parameters and the prepopulate module can do its job.

Is that possible?

Thanks

By the way: I did some changing to the search url to search using a view, and pass view arguments via url, like this:

   // Get the current request.
    $current_request = \Drupal::request();

    // Get all query parameters from the current URL.
    $query_parameters = $current_request->query->all();

    // Add the query parameters to the URL.
    $url->setOption('query', $query_parameters);

Works well with "simple" text parameters, but it does not work well with parameters like edit[field_animal][widget][0][target_id]=15 because it transforms to html characters descriptions like edit%5Bfield_animal%5D%5Bwidget%5D%5B0%5D%5Btarget_id%5D
but its still usable for "simple" parameters, so I thought I should mention it.

Feature request
Status

Active

Version

1.0

Component

Code

Created by

🇵🇹Portugal Miguel Andrade

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024