Closed vierkantemeter closed 9 years ago
Modx version?
Sorry, forgot to mention.
MODX 2.3.3 GCK 1.0.1 rc3
Ow, sorry, I didn't realize you've chip in?
this works, notice the string 'true'
<?php
if ($input == 'true') {
return 'yes';
} else {
return 'no';
}
return '';
Hi Goldsky, unfortunately that's also not working for me. Same result... If you want I can give you a login to have a look.
sure, goldsky@virtudraft.com please
Thanks! I emailed you the details.
Did you find anything?
(For any other readers; goldsky looked at my install, and it's a bug)
I thought I've answered your email, and you understood by saying 'OK' :)
I believe, the output filter for the published overrides the expected value for the grid to render the output. It expects boolean result, while the output filter overrides it to "no" or "yes" string. Once you remove the output filter, all the related functions, like: icon, style, and right-click menu, should work back. The work around is by creating another snippet that gets that "published" value, and add that snippet into the GCK's column.
But nevermind, I've make the snippet, gckpublished
becomes the field, not the output filter.
Thanks, didn't get that email! But I just checked the site again and everything works. Thank you! Could you explain how the gckpublished snippet gets the published value? Is this by default available in $scriptProperties['published'] ?
For each row, yes. You can uncomment the logging line, and check the error log.
Alright, thanks!
For anyone interested, here is the snippet code. Add this as snippet field in GCK.
<?php
//$modx->log(modX::LOG_LEVEL_ERROR, __LINE__ . ': $scriptProperties ' . print_r($scriptProperties, 1));
if ($scriptProperties['published'] == '1') {
return 'Published';
} else {
return 'Unpublished';
}
return '';
I'm trying to use an output filter for the published column, like this:
if ($input == true) { return 'yes'; } else { return 'no'; } return '';
I named it 'gckpublished' and I added it to the column 'output filter' like this: :gckpublished
What happens is that I do see 'yes' and 'no' correct in the published column, but it's like the resource is always published for GCK: the action icon and context menu are wrong ('unpublish' when the resource was already unpublished) and the resource is not displayed in italics. So it looks like it's published, but it's not.
What could be wrong? I also tried with 1 instead of true, and with quotes. Same result.
What could be the problem?