statamic / ideas

💡Discussions on ideas and feature requests for Statamic
https://statamic.dev
30 stars 1 forks source link

Link fieldtype: Pass the selected type in the field data #1064

Open taylorcammack opened 8 months ago

taylorcammack commented 8 months ago

Unless I'm missing something, currently when using the Link fieldtype, the only way to tell the "type" on the front-end is is do some funky URL parsing. Would rather it be explicitly included in the YAML.

  id: lmp0la5o
  text: 'Test Outside Link'
  link: 'https://google.com'
  new_tab: true  
  👉 link_type: url

  id: lmp0lqp6
  text: 'Test Internal Link'
  link: 'entry::037a95c2-d09c-49e4-8978-e3f4f4d3a32f'
  new_tab: false
👉 link_type: asset

It appears an original idea was to change the link handle (from current documentation which appears to be incorrect or outdated). This would also work, but feels like it'd gum up the view, which is probably why it was changed.

---
url_link: 'https://statamic.com'
entry_link: 'entry::9d682ce3-a353-4fdd-af5e-c1d21b7a87f7'
first_child_link: '@child'