Development

Creating a Drupal 8 Route to a User Page with Dynamic User Object

It took me some time to figure out the right combination of properties to make this work.

My goal was to create a form that lives at /user/UID/photo (think /user/1/edit).

I wanted the user object to be passed into the form as an argument.

Here’s the mymodule.routing.yml file:

Here’s the src/Form/ProfilePhoto.php file:

 

Leave a Reply

Your email address will not be published.