MIGX icon indicating copy to clipboard operation
MIGX copied to clipboard

this.renderChunk Issue

Open sammygriffiths opened this issue 10 years ago • 4 comments

I want to use the renderChunk renderer so as to use the image+ snippet to display an image in the column. But I've found that using renderChunk sets whatever is in the renderChunk template as the value of the entry.

For a simple example; I have a migx TV where policies on animals can be added, I want the column to be rendered with h1 tags around the values, so I use the renderChunk renderer like so: image.

I then edit the resource that this TV is applied to and add a value, it is rendered wrapped in h1 tags so displayed bolder I would expect: image.

If I then go to edit that value it has the h1 tags added to it's value, and if I save it it will be saved with these h1 tags and have more added by the renderer, and so on. Image.

It's quite possible that I'm doing something wrong here, but surely this isn't the expected behaviour? Shouldn't the renderer only be responsible for how the value looks in the column and not affect the actual value?

Thanks.

sammygriffiths avatar Sep 09 '15 15:09 sammygriffiths

I wonder if this issue is related to the one I have just raised: https://github.com/Bruno17/MIGX/issues/252

scorchsoft avatar Feb 25 '16 11:02 scorchsoft

no, you allways have to use another fieldname for a renderchunk-column. There is no way arround at this time. The rendered value will be the value of that field in the record.

Bruno17 avatar Feb 25 '16 13:02 Bruno17

Take a look at this page: http://fluence.world/case-studies-and-success-stories

We have the following feild list: example feild list.txt

and the TPL for it looks like so: TPL look.txt

when the new field we added was "block_size"

You can see that when it loops the only HTML that it is outputting is the following:

<img src="/assets/components/phpthumbof/cache/JW%20–%20Cookham%20Wood.52c34b60b8700d8a1cf8241f05dd684616.jpg" alt="Our Work JW - Cookham Wood " class="img-responsive">`]]
 </div>

I.e. everything around it is gone for reference I'm using MigX 2.9.7-pl Maybe you are on the latest nightly? migx-2.9.7-pl.transport.zip

Here is what things look like in the back end: block values 01 block values 02

I can send you the full website and database files if that helps?

scorchsoft avatar Feb 26 '16 16:02 scorchsoft

And just incase the page gets changed, here is an image of how it looks and the source code at the time: screencapture-fluence-world-case-studies-and-success-stories-1456504247181 full page source.txt

You are looking at everything between

<div class="grid" id="our-work-gird">
</div>

In modx the bit that renders this looks like so:

<div class="our-work-block" [[*hideTopSlant:is=`1`:then=` style="background:none;" `]]>
    <div class="container">
        <h2 class="title">[[*OurWorkTitle]]</h2>
        <div class="grid" id="our-work-gird">

            [[*inheritWorkFrom:isnot=``:then=`
                [[getImageList? 
                  &tvname=`OurWork`
                  &tpl=`tpl.workItem`
                  &docid=`[[*inheritWorkFrom]]`]]
            `:else=`
                [[getImageList? 
                  &tvname=`OurWork`
                  &tpl=`tpl.workItem`
                  &docid=`[[*id]]`]]
            `]]



        </div>
    </div>
</div>

scorchsoft avatar Feb 26 '16 16:02 scorchsoft