From 1cedb5a0d6bc113882e520d214f4ba9cea22e232 Mon Sep 17 00:00:00 2001 From: Aleksi Peebles Date: Fri, 1 May 2020 20:56:33 +0300 Subject: [PATCH 1/2] Add note about using RendererInterface::render() Signed-off-by: Aleksi Peebles --- docs/book/helpers/partial.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/book/helpers/partial.md b/docs/book/helpers/partial.md index dc84c13df..d3ef261a2 100644 --- a/docs/book/helpers/partial.md +++ b/docs/book/helpers/partial.md @@ -4,6 +4,11 @@ The `Partial` view helper is used to render a specified template within its own variable scope. The primary use is for reusable template fragments with which you do not need to worry about variable name clashes. +> Note that it is also possible to render a template within its own variable +> scope by calling `RendererInterface::render()` with a `$values` argument. +> See the documentation for [`PhpRenderer`](../php-renderer.md#render) for +> more information. + A sibling to the `Partial`, the `PartialLoop` view helper allows you to pass iterable data, and render a partial for each item. From ea7ddb4995ac6f3d7d0d61eb03830abff2027a18 Mon Sep 17 00:00:00 2001 From: Aleksi Peebles Date: Sat, 2 May 2020 09:31:33 +0300 Subject: [PATCH 2/2] Reword and move note to the end, add headline Signed-off-by: Aleksi Peebles --- docs/book/helpers/partial.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/docs/book/helpers/partial.md b/docs/book/helpers/partial.md index d3ef261a2..65ef39727 100644 --- a/docs/book/helpers/partial.md +++ b/docs/book/helpers/partial.md @@ -4,11 +4,6 @@ The `Partial` view helper is used to render a specified template within its own variable scope. The primary use is for reusable template fragments with which you do not need to worry about variable name clashes. -> Note that it is also possible to render a template within its own variable -> scope by calling `RendererInterface::render()` with a `$values` argument. -> See the documentation for [`PhpRenderer`](../php-renderer.md#render) for -> more information. - A sibling to the `Partial`, the `PartialLoop` view helper allows you to pass iterable data, and render a partial for each item. @@ -80,6 +75,14 @@ Which would then render: > access to your row objects within the view scripts, allowing you to call > methods on them (such as retrieving values from parent or dependent rows). +> ### An alternative to using Partial +> +> Note that it is also possible to render a template within its own variable +> scope by directly calling `RendererInterface::render()` with a `$values` +> argument. You might prefer to do this if your model is an array, or an +> object that implements `ArrayAccess`. See the documentation for +> [`PhpRenderer`](../php-renderer.md#render) for more information. + ## Using PartialLoop to Render Iterable Models Typically, you'll want to use partials in a loop, to render the same content