eZ Community » Forums » eZ Publish 5 Platform » eZ5 with Survey forms in Twig templates
expandshrink

eZ5 with Survey forms in Twig templates

eZ5 with Survey forms in Twig templates

Wednesday 15 October 2014 7:40:00 pm - 9 replies

Hello everyone,

I'm trying to work with eZSurvey in a Twig template, but when I access the full view of the object, the content.field.survey brings an empty result.

Is there different way to work with Survey here?

Wednesday 15 October 2014 11:28:54 pm

Hello Alexandre,

I think the problem starts with eZ Survey uses / provides a custom legacy datatype 'ezsurvey' which is not provide by default within eZ Publish New Stack as a FieldType.

https://github.com/ezsystems/ezsurvey/blob/master/datatypes/ezsurvey/ezsurveytype.php

You would need to create a new 'new stack' FieldType implementing the ezsurvey legacy datatype internals to do what your talking about since it is a custom datatype.

Here is a list of the new stack FieldTypes provided by default: https://doc.ez.no/display/EZP/FieldTypes+reference

I hope this helps!

Cheers,
Heath

Thursday 16 October 2014 1:22:58 pm

The reply has been removed because of violation of forum rules.

Thursday 16 October 2014 3:38:16 pm

Hi Heath, thanks for the quick answer!

It brought me a new vision of the situation.

I already have, in my site bundle, a custom content_fields.html.twig that extends "EzPublishCoreBundle::content_fields.html.twig".

Here I changed some blocks for ezxmltext_field that was needed.

But about Survey, could you point me the ezsurvey legacy datatype blocks that I need to create? Maybe it's my newbie mistake but I didn't figure it out just lookin the ezsurveydatatype.php.

Thanks!

Thursday 16 October 2014 7:40:51 pm

Hello Alexandre,

I'm not an eZ Publish New Stack Expert ... yet blunk.gif Emoticon

But I do know you need to create a new 'FieldType' in a new stack bundle for your site.

Here is a link to the default FieldTypes which you can learn from.

https://github.com/ezsystems/ezpublish-kernel/tree/master/eZ/Publish/Core/FieldType

 

Sorry but someone else will need to guide you through creating a new stack FieldType that corresponds to the eZSurvey datatype.

 

Perhaps this tutorial will help: http://share.ez.no/blogs/core-development-team/the-ez-publish-5-fieldtype-tutorial-is-available

https://doc.ez.no/display/EZP/eZ+Publish+5+Field+Type+Tutorial

 

I hope this helps!

Cheers,
Heath

Monday 20 October 2014 3:16:56 pm

Hello Heath,

Thanks alot for the answer.

I'll probably need a specific guide to create the new stack FildType for eZSurvey.

But I still have a doubt that doesn't leave me!

When I access my Survey object through Twig template, and I look the attributes, using {{ dump() }}, my content -> fields -> survey is NULL!

It's really weird becouse my form has fields and, even without the right FieldType, it should show something here, doesnt' it?

Am I doing something else wrong?

Monday 20 October 2014 3:57:26 pm

Hi Heath,

My bad here! Now I understood it better!

What I see in my {{ dump() }} is:

  'survey' =>     <strong>array</strong>      'nor-NO' =>         <strong>object</strong>(<em>eZ\Publish\Core\FieldType\Null\Value</em>)[<em>3676</em>]          <em>public</em> 'value' => null

It's clear now that, because I don't have my new stack FieldType for eZSurvey, it's using FieldType->Null to show.

I'll really need some help here to build this new stack. Probably eZ needs this stack while it's using Legacy extension...

Maybe someone esle could help here!

Tuesday 09 May 2017 12:54:28 pm

Hi,

Has anyone solved this problem?

I'm working with eZ Publish 5.4 and I'm trying to develop a survey using the extension eZ Survey 2.x. If I use the template by default everything works. The problem comes when I try to use an specific template because when I try to get the survey value, it is Null.

I've read that the eZ Survey FieldType is not supported by the Public API (EZP-20117), should I create a new 'FieldType' for the survey? How can I do it?

Thanks in advance,

Araceli González

Tuesday 09 May 2017 10:46:35 pm

Hello Aracieli,

As you already know eZ Survey is not supported by eZ Publish Platform 5.4 (new Stack), only if you ran it in legacy mode.

Is this a new project you are working on? If so i suggest you to use eZ Platform 1.9, it has a Form Builder functionality that might help you.

If you are stuck in eZ Publish Platform 5.4, and you want to work with eZ Survey, you will need to write all FieldTypes that eZ Survey needs.

Hope it helps.

Friday 19 May 2017 5:00:03 pm

Quote from Alexandre Martins :

If you are stuck in eZ Publish Platform 5.4, and you want to work with eZ Survey, you will need to write all FieldTypes that eZ Survey needs.

Or you need to fallback to legacy view for viweing this part. Such fallbacks (and others like it) is possible.

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from