Giter Club home page Giter Club logo

Comments (22)

vlad-ghita avatar vlad-ghita commented on July 28, 2024

This should work, no problem. On these lines, replace IDs in SBLs and only then commit entries. Sections Event updates Reflection fields.

Is this a bug in latest version?

from sections_event.

patrickyan avatar patrickyan commented on July 28, 2024

Yes, as far as I can tell the reflections aren't being updated after SBL (need to go back and save again)

from sections_event.

patrickyan avatar patrickyan commented on July 28, 2024

It also looks like editing entries does not force reflection fields to update.

from sections_event.

vlad-ghita avatar vlad-ghita commented on July 28, 2024

Aaaaa, I know this! :)

In order to be updated, the Reflection field needs to be triggered, included in the form.

In your case, the Reflection (settings or what's the name) uses published, images attached and gender. Make sure that whenever you change any of these, you include the Reflection as well.

<input name="sections[orders][settings]" value="" type="hidden"/>

Another thing on Reflection. Even if you update the value for one used field, do supply the values for all used fields because settings needs the values from all three in order to process correctly.

from sections_event.

patrickyan avatar patrickyan commented on July 28, 2024

That fixed the problem with editing entries!

But the problem with SBL linked entries still exists. Reflection still seems to be running before the SBL field is updated.

from sections_event.

vlad-ghita avatar vlad-ghita commented on July 28, 2024

So, if you supply a form with these values:

<input name="sections[orders][settings]" value="" type="hidden"/>
<input name="sections[orders][published]" value="yes" type="hidden"/>
<input name="sections[orders][images][]" value="483" type="hidden"/>
<input name="sections[orders][images][]" value="297" type="hidden"/>
<input name="sections[orders][gender]" value="Male" type="hidden"/>

You say that settings will have incorrect values?

Please supply a working example of your use case and a not working example (in the same fashion above).

from sections_event.

vlad-ghita avatar vlad-ghita commented on July 28, 2024

K. I found the problem. A fix is on the way.

from sections_event.

vlad-ghita avatar vlad-ghita commented on July 28, 2024

Fixed in this commit.

The order in which sections are executed is important for Entries with Reflection field.

In your case, you have an Images section and an Orders section (don't know the name, using this one). Since the Reflection field in Orders section uses the SBL field that points to Images section, Images must be saved first, and then the Order, so Order Entry has titles from Images.

In your form, use the __order key to specify the order of sections:

<input name="sections[__order]" type="hidden" value="images,orders" />

from sections_event.

patrickyan avatar patrickyan commented on July 28, 2024

Thanks so much, Vlad. Sorry that I’m so slow! Will try this out today :)

from sections_event.

patrickyan avatar patrickyan commented on July 28, 2024

Unfortunately, it doesn’t seem like this works. (I used that exact input.) To be specific, the reflection field is being updated correctly when entries are edited. However, when new entries are created, the SBL field is still ignored.

from sections_event.

vlad-ghita avatar vlad-ghita commented on July 28, 2024

:| weird. It's working fine for me. I was in same situation yesterday and the patch fixed it ...

What are the names of your sections? Images and ... ?

from sections_event.

patrickyan avatar patrickyan commented on July 28, 2024

It’s images and listings. In listings, the reflection field is called sort-key and the SBL is called images. sort-key is only getting the right SBL values after editing through front end with sections_event OR resaved through the Symphony admin.

from sections_event.

vlad-ghita avatar vlad-ghita commented on July 28, 2024

So if you send this in the form it still doesn't work?

<input name="sections[__order]" type="hidden" value="images,listings" />

What's the result from print_r($sections_input) on line 82?

What's the result from print_r($_REQUEST) as well?

Let's make sure the order is correct.

from sections_event.

patrickyan avatar patrickyan commented on July 28, 2024

$sections_input @ line 82

[redacted]

from sections_event.

vlad-ghita avatar vlad-ghita commented on July 28, 2024

Well, hello problem. It seems the order isn't computed as it should.

Please replace these lines with these:

print_r($sections_input);

$order = null;
if( isset($sections_input['__order']) && is_string($sections_input['__order']) ){
    $order = array_filter(explode(',', $sections_input['__order']));
    unset($sections_input['__order']);
}

if( is_array($order) ){
    $sections_input = array_merge(array_flip($order), $sections_input);
}

print_r($sections_input);die;

And show me the output.

Thanks.

from sections_event.

patrickyan avatar patrickyan commented on July 28, 2024

Here you go

[redacted]

from sections_event.

patrickyan avatar patrickyan commented on July 28, 2024

This may also be related, but the reflection field doesn’t update correctly. I have a field that calculates a duration from the date/time field and then multiplies by a number field. When editing entries (changing the number and dates), the reflection field changes based on the new number but not the duration.

from sections_event.

patrickyan avatar patrickyan commented on July 28, 2024

(Saving in the Symphony admin works perfectly.)

from sections_event.

vlad-ghita avatar vlad-ghita commented on July 28, 2024

You can safely remove the print_r(...) instructions from my previous comment.

Everything seems to be fine, from Sections Event point of view. The order of of keys in processed array is images, listings, which is correct.

I think there is another issue here. I recommend you debug this step by step and see where the other problem is.

from sections_event.

patrickyan avatar patrickyan commented on July 28, 2024

@vlad-ghita - It works now, but it’s because your previous comment also changed the code. I’m guessing it’s the array_flip($order). Can you commit this change to the repo?

screen shot 2013-12-25 at 8 51 50 am

from sections_event.

vlad-ghita avatar vlad-ghita commented on July 28, 2024

Yeah, I wanted to commit it, but was waiting for positive feedback :)

from sections_event.

patrickyan avatar patrickyan commented on July 28, 2024

Awesome!

from sections_event.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.