diff --git a/src/Turbo/CHANGELOG.md b/src/Turbo/CHANGELOG.md index 872b94307bb..ab8707b6720 100644 --- a/src/Turbo/CHANGELOG.md +++ b/src/Turbo/CHANGELOG.md @@ -2,6 +2,7 @@ ## 2.22.0 +- Include minimal layout for Turbo Frames - Add `` component - Add `` component diff --git a/src/Turbo/doc/index.rst b/src/Turbo/doc/index.rst index 4618bd701c2..c55c6048371 100644 --- a/src/Turbo/doc/index.rst +++ b/src/Turbo/doc/index.rst @@ -288,6 +288,47 @@ With content: A placeholder. +Minimal layout for Turbo Frames +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. versionadded:: 2.22 + + The minimal layout for Turbo Frames was added in Turbo 2.22. + +Since Turbo does not need the content outside of the frame, reducing the amount that is rendered can be a useful optimisation. There are cases where it would be useful for Turbo to have access to items specified in ``head``. To specify the heads, you must then use a minimal layout for frame, rather than no layout. it allows you to set ``meta`` tags while still having a minimal layout. + +.. code-block:: php + + // src/Controller/TaskController.php + namespace App\Controller; + + // ... + + class TaskController extends AbstractController + { + public function markAllAsDone(): Response + { + return $this->renderBlock('task/index.html.twig', 'mark_all_as_done'); + } + } + +.. code-block:: html+twig + + {# bottom of task/index.html.twig #} + {% block mark_all_as_done %} + + + + + + + + A placeholder. + + + + {% endblock %} + Writing Tests ^^^^^^^^^^^^^