We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36804
    • 19 Posts
    I have a bunch of boolean columns in custom tables that I would usually just pass through to JS on the frontend for rendering but I'm wondering about doing this on the server end.

    What would be the most efficient xPDO way to replace the conditional in line 6 below?

    $chunk = $modx->getParser()->getElement('modChunk', 'TitleItem');
    $chunk->setCacheable(false);
    
    foreach($docs as $doc) {
        $fields = $doc->toArray();
        $fields['illustrated'] = $fields['illustrated'] == 0 ? '' : '/Illustrated';
        $chunk->_processed = false;// This row is required
        $output .= $chunk->process($fields);
    }