make_link = (
  {
    link_text,
    link_text_formula,
    link_url,
    link_url_formula,
    link_target_blank,
    in_dropdown,
    in_modal,
    link_icon,
    icon,
    link_style,
    link_size,
  },
  fields,
  __ = (s) => s,
  in_row_click
) => {
  return {
    label: "",
    key: (r) => {
      let txt, href;
      const theIcon = link_icon || icon;

      txt = link_text_formula
        ? eval_expression(link_text, r, undefined, "Link text formula")
        : link_text;

      href = link_url_formula
        ? eval_expression(link_url, r, undefined, "Link URL formula")
        : link_url;

      const attrs = { href };
      if (link_target_blank) attrs.target = "_blank";
      if (in_dropdown) attrs.class = ["dropdown-item"];
      if (link_style) attrs.class = [...(attrs.class || []), link_style];
      if (link_size) attrs.class = [...(attrs.class || []), link_size];
      if (in_row_click) attrs.onclick = "event.stopPropagation()";
      if (in_modal)
        return a(
          {
            ...attrs,
            href: "javascript:void(0)",
            onclick: isNode()
              ? `ajax_modal('${href}');` + (attrs.onclick || "")
              : `mobile_modal('${href}');` + (attrs.onclick || ""),
          },
          !!theIcon && theIcon !== "empty" && i({ class: theIcon }),
          txt
        );
      return a(
        attrs,
        !!theIcon && theIcon !== "empty" && i({ class: theIcon }),
        txt
      );
    },
  };
}
@function
@param {object} opts
@param {string} opts.link_text
@param {boolean} opts.link_text_formula missing in contract
@param {string} [opts.link_url]
@param {boolean} opts.link_url_formula
@param {boolean} opts.link_target_blank
@param {Field[]} fields
@returns {object}