-
-
Notifications
You must be signed in to change notification settings - Fork 9
Remove extension, rename ViewRenderer.php
, update docs
#61
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be improve TemplateRendererInterface
from yiisoft/view
. For example:
interface TemplateRendererInterface
{
public function render(string $templateFile, array $parameters, TemplateContext $templateContext): string;
}
final class TemplateContext {
public function __construct(
private ViewInterface $view,
private string $template,
) {
}
}
It's allow send additional information from view to template renderer. Also we can normalize template path in view instead of TemplateRendererInterface
implementation.
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #61 +/- ##
===========================================
Coverage 100.00% 100.00%
+ Complexity 6 4 -2
===========================================
Files 2 1 -1
Lines 28 18 -10
===========================================
- Hits 28 18 -10
☔ View full report in Codecov by Sentry. |
Please fix failing static analysis. |
src/TemplateRenderer.php
Outdated
* TemplateRenderer allows using Twig with a View service. | ||
*/ | ||
final class ViewRenderer implements TemplateRendererInterface | ||
final class TemplateRenderer implements TemplateRendererInterface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be call it "TwigTemplateRenderer"? What do you think?
## 2.1.1 under development | ||
|
||
- Chg #61: Rename `ViewRenderer` to more understandable `TemplateRenderer` (@rustamwin) | ||
- Chg #61: Remove `YiiTwigExtension` (@rustamwin) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Create UPGRADE.md
also with instructions to upgrade. These changes breaks BC.
* YiiTwigExtension adds additional functionality to the Twig engine. | ||
*/ | ||
final class YiiTwigExtension extends AbstractExtension | ||
final class SimpleExtension extends AbstractExtension |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
Why remove
YiiTwigExtension
? -
If remove, why does it need in tests?
|
||
echo $environment->render($file, array_merge($parameters, ['this' => $view])); | ||
}; | ||
$templateFile = str_replace( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if $template
placed not in base path?
Uh oh!
There was an error while loading. Please reload this page.