GetTvOption but then for MIGX

Hello all,

I use GetTvOption snippet to retrieve tvs for in a list-box in the front-end, and it works fine.

<?php
$tv = $modx->getObject('modTemplateVar',array('name'=>$tvname));
$options = explode('||',$tv->get('elements'));
  
foreach ($options as $option){
    $opt = explode ('==',$option);
    $ph['value'] = count($opt)>1 ? $opt[1]: $opt[0];
    $ph['text'] = $opt[0];
    $ph['name'] = !empty($asArray) ? $name.'[]' : $name;
    $ph['checked'] = ''; 
    $ph['selected'] = '';
     
    if ($ph['name']==$ph['value'])
        {
            $ph['checked'] = 'checked="checked"'; 
            $ph['selected'] = 'selected="selected"';      
        }
      
        $output .= $modx->getChunk($tpl,$ph);
    }
   
return $output;

Is it possible to do the same, but then for a MIGX tv variable ?
I fetch them with GetImageList, but can’t get the value to $name.

Can someone help me ?

greetings,
Appeltje from the Holland

can’t see, how $name is defined in your snippet