I'm pretty new to Drupal 8 and I wanted to render the user profile (user/[user_id]/edit) from in a certain page which will be created through a custom module. I wanted to this because I want the users to edit their profile without going to the user/[user_id]/edit page.
here's what I have done so far in my controller:
namespace Drupal\my_account\Controller
use Drupal\user\ProfileForm
class MyAccountController{
public function content(){
$entity = \Drupal::entityManager()
->getStorage('user')
->create(array());
$formObject = \Drupal::entityManager()
->getFormObject('user', 'default')
->setEntity($entity);
$form = \Drupal::formBuilder()->getForm($formObject);
return ['form'=>$form];
}
}
It manages to display the form but no user contents.