Use hook_views_pre_render() to change field to url link I want to use hook_views_pre_render() to read in a view and change a field output to a clickable link.

Here is code:

function sbn_views_pre_render(ViewExecutable $view) {
    // https://drupal.stackexchange.com/questions/272495/how-to-get-views-field-names-values-for-hook-views-pre-render
    if ($view-&gt;id() == 'find_paragraphs') {
      foreach ($view-&gt;result as $key =&gt; $value) {
        $parent_id_value =  $value-&gt;_entity-&gt;parent_id-&gt;getValue()[0]['value'];
        $parent_type_value =  $value-&gt;_entity-&gt;parent_type-&gt;getValue()[0]['value'];
        $private_files = $value-&gt;_entity-&gt;field_private_files-&gt;getValue()[0]['value'];
        if ($parent_type_value == 'node') {
          $link = '&lt;a href="/node/'.$parent_id_value.'"&gt;'.$parent_id_value.'&lt;/a&gt;';
          // $value-&gt;_entity-&gt;set('parent_id', $link);        
        }
        if ($parent_type_value == 'paragraph') {
        }
      }
    }
}


Formatting the $link value using standard html coding does not work.  Any ideas on how to format the link from within this hook so that the rendered field is a clickable link?
I have not been able to figure out how to conditionally change field to link using hook_views_pre_render(), but I did figure out how to do it within the Views UI:

Fields->Parent ID->Rewrite results->Override the output of this field with custom text:

{% if parent_type == 'paragraph' %}
&lt;a href="/find-paragraphs?id={{ parent_id }}"&gt;{{ parent_id }}&lt;/a&gt;
{% else %}
&lt;a href="/node/{{ parent_id }}"&gt;{{ parent_id }}&lt;/a&gt;
{% endif %}