DeuxHuitHuit / entry_relationship_field

A new way to create master-details pattern with Symphony's sections
http://symphonyextensions.com/extensions/entry_relationship_field/
Other
11 stars 12 forks source link

Formatters and ERF datasource output #55

Closed andrewminton closed 6 years ago

andrewminton commented 8 years ago

Not sure if this has been discussed at all, but when you include all child elements in the ERF field. Textareas with formatters do not represent the correct output desired.

I see this sort of action on my textareas:

<content mode="">[CDATA[....#my content]]</content>

No mode and the markdown isn't rendered as HTML for me.

Is this not catered for with ERF?

nitriques commented 8 years ago

I had some problems with this and it may not be 100% resolved. Can you tell me

  1. What's the field's settings regarding included element
  2. What's in your data-source

Thanks.

andrewminton commented 8 years ago

I have textarea.*, gallery.*, image.* as included element items (sections) within publish settings along with all options checked for new,link,edit,delete.

My Datasource has content:* with 'content' being the name I gave to the ERF field in my section.

Here's a pastie of the DS for my page datasource: http://pastie.org/private/lu2egrnv9iglvmpzcuuuq

nitriques commented 8 years ago

Can you try to see what you get when you set the field's setting to *

andrewminton commented 8 years ago

As in change the included elements to: * in the field section editor?

If so, done that, no joy.

nitriques commented 8 years ago

:( And we are talking about the core Textarea Field ?

andrewminton commented 8 years ago

Yes correct. Core field using standard markdown extension.

andrewminton commented 8 years ago

Is it because we're not actually specifying the intended output with textarea:formatted in the DS?

Usually we have to specify that we'd like the output to be formatted or not. Maybe this is why it's just grabbing the default output as it appears in the value field and not the value-formatted filed from the DB.

andrewminton commented 8 years ago

Should we maybe spit out the formatted and unformatted modes into the DS by default? if it was left to the DS editor it may complicate the selection options too much.

andrewminton commented 8 years ago

If I replace $curMode with formatted on this line: https://github.com/DeuxHuitHuit/entry_relationship_field/blob/master/fields/field.entry_relationship.php#L704

The textarea outputs the formatted/escaped entity value. The values are definately there, it's just not choosing between value and formatted_value and just returns the first entry in array each time which will always be value I guess.

nitriques commented 8 years ago

Hum... can you var_dump($fieldIncludableElements) juste bfore this line: https://github.com/DeuxHuitHuit/entry_relationship_field/blob/master/fields/field.entry_relationship.php#L696

It should output ALL modes by default...

andrewminton commented 8 years ago

@nitriques The above returns null for me. No matter what I include in the Publish settings tag list.... text.* etc.. it always seems to return null on the front end.

nitriques commented 8 years ago

hum.. and what's in $curMode ?

andrewminton commented 8 years ago

By placing $curMode on line 696 I get string 'formatted' (length=9) returned.

nitriques commented 8 years ago

So the variable contains the good information... I really wonder why the field does not produce the right value... Just to be sure: changing $curMode to 'formatted' solves the problem ?

andrewminton commented 8 years ago

The variable outputs an escaped entity string version of the textarea field and not html markup as it does normally with other datasources when you choose formatted within the DS included elements. So it's not fully solved.

nitriques commented 8 years ago

Ok. But do you have a different XML output by replacing the variable $curMode (which contains 'formatted') to the hardcoded string 'formatted' ?

andrewminton commented 8 years ago

screen shot 2016-02-09 at 21 46 43

Not sure I understand what you mean above. I hard coded the variable $curMode to 'formatted' on line 696 and the above grab of my datasource show what I see in my debug.. escaped entities instead of html tags.

If I hard code 'formatted' in place of $curMode or $subMode in the following functions. It still returns the escaped entities seen in the screen grab.

nitriques commented 8 years ago

The match-element being formatted renders me clue less...

just to be sure, if you create a datasource to output your child section, is the markup ok ?

and you do select 'content: *' in your current DS ?

andrewminton commented 8 years ago

Yes I'm selecting content:*

Weirdly I've just hard coded 'formatted' place of $subMode and $curMode variables and all is rendered correctly in the XML debug view.

nitriques commented 8 years ago

Ok I'll try to tackle this ...

andrewminton commented 8 years ago

IF you need any more information about my environment.. I'm running a build of vagrant from this repo: https://github.com/lnikkila/symphony-simple-vagrant as a test environment to build my sites locally. Thanks.

nitriques commented 8 years ago

Which version of Symphony is it ?

andrewminton commented 8 years ago

2.6.4 or 2.6.5 I believe. I'll need to check though as I'm not at my dev machine

nitriques commented 8 years ago

I am not able to reproduce the bug... are you running 1.0.3 ?

nitriques commented 8 years ago

Oh wait: Textbox are working, but not text area...

nitriques commented 8 years ago

But I get this:

<item id="47" level="1" max-level="-1" section-id="42" section="text-area" matched-element="">
        <text mode=""><![CDATA[test **sasa**]]></text>
        <text-side mode=""><![CDATA[ test  *sssasa*]]></text-side>
</item>
andrewminton commented 8 years ago

Thats what I see... unformatted. :(

nitriques commented 8 years ago

At least we have the same output ! haha

andrewminton commented 8 years ago

Which is a good thing :)

nitriques commented 8 years ago

I've isolated the problem down to the fact that the text area returns unformatted data when mode is null but textbox does the opposite.. meanwhile.. that's a bug..

andrewminton commented 8 years ago

haha! so glad it wasn't me this time :) So textbox returns formatted by default?

nitriques commented 8 years ago

So textbox returns formatted by default?

If mode is null, yes.

andrewminton commented 8 years ago

Well there we are then.. consistency all round I see :)