Git Product home page Git Product logo

Comments (7)

nilshoerrmann avatar nilshoerrmann commented on July 17, 2024

This might be related to some changes in the core. I'll check this issue later this week.

from subsectionmanager.

nilshoerrmann avatar nilshoerrmann commented on July 17, 2024

I cannot reproduce this behaviour in my current install. Could you please check the latest Subsection Manager code. Thanks!

from subsectionmanager.

nilshoerrmann avatar nilshoerrmann commented on July 17, 2024

Grzegorz, are you still experiencing this?

from subsectionmanager.

icek avatar icek commented on July 17, 2024

So far no, but tommorow I'll do some more tests.

from subsectionmanager.

nilshoerrmann avatar nilshoerrmann commented on July 17, 2024

This issue doesn't make sense to me. If you have only one item selected, $data will be passed like this:

Array
(
    [relation_id] => 92
)

If you have multiple items selected, $data should look like this:

Array
(
    [relation_id] => Array
        (
            [0] => 88
            [1] => 89
        )

)

In the latter case the IDs should be returned as a comma separated string which is done using this line of code:

if(is_array($data['relation_id'])) return implode(", ", $data['relation_id']);

It correctly returns this in my parameter pool:

$ds-test    '92, 88, 89'

Could you please change your getParameterPoolValue() function like so and report back what is returned when you browse to your parameter pool?

public function getParameterPoolValue($data) {

    print_r($data);
    if(is_array($data['relation_id'])) return implode(", ", $data['relation_id']);
    return $data['relation_id'];

}

(Please don't mind the error you'll receive after the output or the print_r function.)

from subsectionmanager.

tmslnz avatar tmslnz commented on July 17, 2024

Hi Nils, I bumped into the comma-separated list bug once again. Well, actually it behaves "correctly" as you describe above, returning:

<ds-sampler-media>
    <item handle="21-11-2-4-14-26-13-23">21, 11, 2, 4, 14, 26, 13, 23</item>
</ds-sampler-media>
<ds-sampler-media-to-project-link>
    <item handle="20">20</item>
</ds-sampler-media-to-project-link>

But this way Symphony only uses the first ID and ignores the rest, as you can see from the single-item result (expecting 3)

Replacing this in field.subsectionmanager.php:

if(is_array($data['relation_id'])) {
    return implode(", ", $data['relation_id']);
}
else {
    return $data['relation_id'];
}

With:

return $data['relation_id'];

Makes Symphony and me happy, giving the correct result:

<ds-sampler-media>
    <item handle="21">21</item>
    <item handle="11">11</item>
    <item handle="2">2</item>
    <item handle="4">4</item>
    <item handle="14">14</item>
    <item handle="26">26</item>
    <item handle="13">13</item>
    <item handle="23">23</item>
</ds-sampler-media>
<ds-sampler-media-to-project-link>
    <item handle="20">20</item>
    <item handle="20">20</item>
    <item handle="20">20</item>
    <item handle="6">6</item>
    <item handle="6">6</item>
    <item handle="6">6</item>
    <item handle="5">5</item>
    <item handle="5">5</item>
</ds-sampler-media-to-project-link>

May ask why you are imploding that into a comma-separated list that doesn't seem to be working? Thanks for this extension anyway, I still don't understand why it isn't already in the default Symphony distribution.

from subsectionmanager.

nilshoerrmann avatar nilshoerrmann commented on July 17, 2024

May ask why you are imploding that into a comma-separated list that doesn't seem to be working?

The problem is that parameters don't allow multiple item thus the need to join all items in comma separated list. Symphony 2.2 introduced the output of parameters in the XML but for data source filtering you still need the parameter.

In your case: Take your data source and let it output $ds-sampler-media with a comma-separated list of ids. Use this parameter as filter in another data source to get your desired output.

This is a Symphony limitation.

from subsectionmanager.

Related Issues (20)

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.