Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify Renderer discrepancy #4102

Merged
merged 3 commits into from
Jan 16, 2021
Merged
Show file tree
Hide file tree
Changes from 2 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
8 changes: 2 additions & 6 deletions system/View/RendererInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ interface RendererInterface
* @param array $options Reserved for 3rd-party uses since
* it might be needed to pass additional info
* to other template engines.
* @param boolean $saveData If true, will save data for use with any other calls,
* if false, will clean the data after displaying the view,
* if not specified, use the config setting.
* @param boolean $saveData Whether to save data for subsequent calls
*
* @return string
*/
Expand All @@ -44,9 +42,7 @@ public function render(string $view, array $options = null, bool $saveData = fal
* @param array $options Reserved for 3rd-party uses since
* it might be needed to pass additional info
* to other template engines.
* @param boolean $saveData If true, will save data for use with any other calls,
* if false, will clean the data after displaying the view,
* if not specified, use the config setting.
* @param boolean $saveData Whether to save data for subsequent calls
*
* @return string
*/
Expand Down
28 changes: 16 additions & 12 deletions system/View/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,16 @@ public function __construct(ViewConfig $config, string $viewPath = null, FileLoc
* data that has already been set.
*
* Valid $options:
* - cache number of seconds to cache for
* - cache_name Name to use for cache
* - cache Number of seconds to cache for
* - cache_name Name to use for cache
*
* @param string $view
* @param array|null $options
* @param boolean|null $saveData
* @param string $view File name of the view source
* @param array $options Reserved for 3rd-party uses since
* it might be needed to pass additional info
* to other template engines.
* @param boolean|null $saveData If true, saves data for subsequent calls,
* if false, cleans the data after displaying,
* if null, uses the config setting.
*
* @return string
*/
Expand Down Expand Up @@ -272,13 +276,13 @@ public function render(string $view, array $options = null, bool $saveData = nul
* data that has already been set.
* Cache does not apply, because there is no "key".
*
* @param string $view The view contents
* @param array $options Reserved for 3rd-party uses since
* it might be needed to pass additional info
* to other template engines.
* @param boolean $saveData If true, will save data for use with any other calls,
* if false, will clean the data after displaying the view,
* if not specified, use the config setting.
* @param string $view The view contents
* @param array $options Reserved for 3rd-party uses since
* it might be needed to pass additional info
* to other template engines.
* @param boolean|null $saveData If true, saves data for subsequent calls,
* if false, cleans the data after displaying,
* if null, uses the config setting.
*
* @return string
*/
Expand Down
15 changes: 9 additions & 6 deletions user_guide_src/source/outgoing/view_renderer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ Several options can be passed to the ``render()`` or ``renderString()`` methods:
ignored for renderString()
- ``saveData`` - true if the view data parameters should be retained for subsequent calls

.. note:: ``saveData`` as defined by the interface must be a boolean, but implementing
classes (like ``View`` below) may extend this to include ``null`` values.

Class Reference
***************

Expand All @@ -110,9 +113,9 @@ Class Reference
.. php:method:: render($view[, $options[, $saveData=false]])
:noindex:

:param string $view: File name of the view source
:param array $options: Array of options, as key/value pairs
:param boolean $saveData: If true, will save data for use with any other calls, if false, will clean the data after rendering the view.
:param string $view: File name of the view source
:param array $options: Array of options, as key/value pairs
:param boolean|null $saveData: If true, will save data for use with any other calls. If false, will clean the data after rendering the view. If null, uses the config setting.
:returns: The rendered text for the chosen view
:rtype: string

Expand All @@ -123,9 +126,9 @@ Class Reference
.. php:method:: renderString($view[, $options[, $saveData=false]])
:noindex:

:param string $view: Contents of the view to render, for instance content retrieved from a database
:param array $options: Array of options, as key/value pairs
:param boolean $saveData: If true, will save data for use with any other calls, if false, will clean the data after rendering the view.
:param string $view: Contents of the view to render, for instance content retrieved from a database
:param array $options: Array of options, as key/value pairs
:param boolean|null $saveData: If true, will save data for use with any other calls. If false, will clean the data after rendering the view. If null, uses the config setting.
:returns: The rendered text for the chosen view
:rtype: string

Expand Down