Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[FrameworkBundle] Replace render() with new renderForm() in form documentation#15105

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletionsform/direct_submit.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -29,9 +29,7 @@ control over when exactly your form is submitted and what data is passed to it::
}
}

return $this->render('task/new.html.twig', [
'form' => $form->createView(),
]);
return $this->renderForm('task/new.html.twig', $form);
}

.. tip::
Expand Down
5 changes: 1 addition & 4 deletionsform/dynamic_form_modification.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -534,10 +534,7 @@ your application. Assume that you have a sport meetup creation controller::
// ... save the meetup, redirect etc.
}

return $this->render(
'meetup/create.html.twig',
['form' => $form->createView()]
);
return $this->renderForm('meetup/create.html.twig', $form);
}

// ...
Expand Down
4 changes: 1 addition & 3 deletionsform/form_collections.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -164,9 +164,7 @@ In your controller, you'll create a new form from the ``TaskType``::
// ... do your form processing, like saving the Task and Tag entities
}

return $this->render('task/new.html.twig', [
'form' => $form->createView(),
]);
return $this->renderForm('task/new.html.twig', $form);
}
}

Expand Down
13 changes: 7 additions & 6 deletionsforms.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -277,12 +277,15 @@ to build another object with the visual representation of the form::

$form = $this->createForm(TaskType::class, $task);

return $this->render('task/new.html.twig', [
'form' => $form->createView(),
]);
return $this->renderForm('task/new.html.twig', $form);
}
}

.. versionadded:: 5.3

The ``renderForm`` method was introduced in Symfony 5.3, allowing to
return 422 HTTP status code if an invalid form is submitted.

Then, use some :ref:`form helper functions <reference-form-twig-functions>` to
render the form contents:

Expand DownExpand Up@@ -405,9 +408,7 @@ written into the form object::
return $this->redirectToRoute('task_success');
}

return $this->render('task/new.html.twig', [
'form' => $form->createView(),
]);
return $this->renderForm('task/new.html.twig', $form);
}
}

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp