Use MIGX TV as input for checkbox TV Source: http://forums.modx.com/forums/thread/71426/use-migx-tv-as-input-for-checkbox-tv#dis-post-399530 Author: michelle84
<?php
/*
Grap checkbox values from a migx grid.
Author: michelle84
*/
$resource = $modx->getObject('modResource',1);
$migxEntries = $resource->getTVValue('tagOptions');
$migxEntries2 = json_decode($migxEntries, true);
$numItems = count($migxEntries2);
$i = 0;
foreach ($migxEntries2 as $key => $jsons) { // This will search in the 2 jsons
foreach($jsons as $key => $value) {
if($i+1 == $numItems) {
$output .= $value."==".$value;
} else {
$output .= $value."==".$value."||";
}
$i++;
}
}
return $output;
input type: migx
Form type:
[{
"caption":"Categories",
"fields": [{
"field":"category",
"caption":"Category"
}]
}]
Grid columns:
[
{"header": "Category", "width": "30", "sortable": "false", "dataIndex": "category"}
]
input type: checkbox
input option values: @EVAL return $modx->runSnippet('readCategoryOptions');