-
Notifications
You must be signed in to change notification settings - Fork 6
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
JsonModel not work #9
Comments
Solved! ;) Here -> ZF-Commons/ZfcTwig#83 |
Hello, If You take a look into class TwigStrategy, then You will find this code: /**
* @param \Zend\View\ViewEvent $e
*
* @return \Zend\View\Renderer\RendererInterface|null
*/
public function selectRender(ViewEvent $e)
{
if ($this->isForceRender()) {
return $this->renderer;
}
$model = $e->getModel();
if ($model instanceof TwigModel) {
return $this->renderer;
}
return null;
} So, You can disable forcing of Twig Render in config like this: 'zend_twig' => [
// ...
/**
* Force Your application to use TwigRender for ViewModel.
* If false, then TwigStrategy will be applied only for TwigModel
*
* @note: In release v.1.5 this parameter will be set to false
*/
'force_twig_strategy' => true, // <- change this to false
// ... After that all should be fine and You will be able to use mix of renders: php, json, twig and other in any order. I hope than will help You. |
Thanks ;) |
Ahh, other question: Various view_helpers not work too. e.g: |
By default some of them already registered, please, find in default module config: 'zend_twig' => [
// ...
/**
* Developer can disable Zend View Helpers like docType, translate and e.t.c.
*/
'invoke_zend_helpers' => true,
// .. So, they should be available. I have test for this, please, find here in twig template and here in test class. One of the docs for ZF3 modules there is recommendation to implement __invoke() method, so in this case we will have |
Yes, I do not know if I'm doing something wrong, or lacking any configuration. |
Step by step:
// ...
'view_manager' => [
'doctype' => \Zend\View\Helper\Doctype::HTML5,
// ...
|
Okay, thanks so much :) |
Hello, i have a Problem: When i change |
@OxCom this is clear, but the parent view model (layout/layout) is a thanks for your help. |
@kargpfen If it still not working, please, (re-)open ticket and provide way how to produce or some info about configuration. |
@OxCom i'm sorry. it was my mistake, the order in the modules list was wrong. :( |
Yo.., allright?
In my Controller, will return JsonModel instance, but when call method, return:
ZendTwig\Renderer\TwigRenderer::render: Unable to render template "user/api/user-authentication/authenticate"; resolver could not resolve to a file
Gist: https://gist.github.com/guilherme90/33e97890ce0e8c4827a4146dc704f206
And yes, i set
ViewJsonStrategy
in view_manager -> strategiesHow can I solve this? Thanks :)
The text was updated successfully, but these errors were encountered: