Skip to content
Snippets Groups Projects
Commit 5fb16e7a authored by Marcin Kolanko's avatar Marcin Kolanko
Browse files

Merge branch 'feat/add-show-rendered-method' into 'master'

Feat/add show rendered method

See merge request !5
parents 8aa5ae0b 154ce6ae
No related branches found
Tags 2.0.0
2 merge requests!8feat/woo template,!5Feat/add show rendered method
Pipeline #6152 passed with stages
in 15 seconds
## [2.0.0] - 2021-10-01
### Added
- Add output_render method to Renderer interface
## [1.1.0] - 2019-09-23
### Added
- PluginViewBuilder to facilitate building and rendering views for plugins
\ No newline at end of file
......@@ -7,7 +7,7 @@
}
],
"require": {
"php": ">=5.5"
"php": ">=7.0"
},
"require-dev": {
"phpunit/phpunit": "<7",
......
......@@ -23,4 +23,10 @@ interface Renderer
* @return string
*/
public function render($template, array $params = null);
/**
* @param string $template
* @param array $params
*/
public function output_render($template, array $params = null);
}
......@@ -34,15 +34,23 @@ class SimplePhpRenderer implements Renderer
* @return string
*/
public function render($template, array $params = null)
{
ob_start();
$this->output_render( $template, $params );
return ob_get_clean();
}
/**
* @param string $template
* @param array|null $params
*/
public function output_render($template, array $params = null)
{
if ($params !== null) {
extract($params, EXTR_SKIP);
}
ob_start();
include($this->resolver->resolve($template . '.php'));
return ob_get_clean();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment