Using a view result as allowed_options in a text(list) field I have a set of values that are created in a different node, and I would like to use them as the allowed values for a field in another node. So, I have a view that collect the values and I have a hook_allowed_values function to create the allowed_values list. My function is:

function hnbuilder_fheq_allowed_values(FieldStorageConfig $definition, ContentEntityInterface $entity = NULL, $cacheable){
    $node = \Drupal::routeMatch()-&gt;getParameter('node');
    if ($node instanceof \Drupal\node\NodeInterface) {
        $nid = $node-&gt;id();
    }
    $view_id = 'default';
    $args = $nid;
    $result = views_get_view_result('outcomes',$view_id,$args);
    return $result;
}


My problem is that my views_get_view_result is not returning anything. I get the correct $nid, and pass this to the views...result. The view, on its own, works fine. But if kint($result), I get nothing.

I've updated the config for the field, to make it call the hook_allowed_values function.

What am I doing wrong?
Here's what I ended up with...

function hnbuilder_fheq_allowed_values(FieldStorageConfig $definition, ContentEntityInterface $entity = NULL, $cacheable){
    $node = \Drupal::routeMatch()-&gt;getParameter('node');
    //kint($node-&gt;bundle());
        if ($node instanceof \Drupal\node\NodeInterface) {
            $thisnid = $node-&gt;get('nid')-&gt;value;
            if($node-&gt;bundle() != 'qualification'){
                $nid = $node-&gt;get('field_qualification')-&gt;target_id;
                }
        }
        $args=[$nid];
        $values = [];
        $view = Views::getView('outcomes');

        if (is_object($view)){
            $view-&gt;setArguments($args);
            $view-&gt;setDisplay('default');
            $view-&gt;execute();
            foreach($view-&gt;result as $rid=&gt;$row){
                foreach ($view-&gt;field as $fid =&gt; $field ) {
                    $values[$rid][$fid . '-value'] = $field-&gt;getValue($row);
                    $my_options[$values[$rid]['field_fheq_code-value']] = "[".$values[$rid]['field_fheq_code-value']."]- ".$values[$rid]['field_fheq_description-value'];
                }
            }
        return $my_options;
    }
}