Controller method for generic HTML form pages.
\Symfony\Component\HttpFoundation\Request $request: The request object.
callable $_form: The name of the form class for this request.
\Symfony\Component\HttpFoundation\Response A response object.
public function content(Request $request, $_form) {
$form_object = $this
->getFormObject($request, $_form);
// Using reflection, find all of the parameters needed by the form in the
// request attributes, skipping $form and $form_state.
// At the form and form_state to trick the getArguments method of the
// controller resolver.
$form_state = array();
$request->attributes
->set('form', array());
$request->attributes
->set('form_state', $form_state);
$args = $this->container
->get('controller_resolver')
->getArguments($request, array(
$form_object,
'buildForm',
));
unset($args[0], $args[1]);
$request->attributes
->remove('form');
$request->attributes
->remove('form_state');
$form_state['build_info']['args'] = $args;
$form_id = _drupal_form_id($form_object, $form_state);
return drupal_build_form($form_id, $form_state);
}