I have the following code which returns a view with a subview. As it can see, the subview repeats the variable $form and the array &fields duplicating the pass of variables into view.
How I can inherit to userProfileInformationView these variables from responseView and inject them only into responseView?
$responseView = new ViewModel();
$responseView->setVariables(array(
'form' => $form,
'fields' => $fields,
'userType' => $userType,
));
$responseView->setTemplate('templates/logged_user_profile');
$responseView->setTerminal(true);
$userProfileInformationView = new ViewModel();
$userProfileInformationView->setTemplate('templates/logged_user_profile_information');
$userProfileInformationView->setVariables(array(
'form' => $form, //I don't want this
'fields' => $fields, //I don't want this
));
$responseView->addChild($userProfileInformationView, 'userProfileInformation');
return $responseView;